/[pcre]/code/trunk/CMakeLists.txt
ViewVC logotype

Diff of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 137 by ph10, Thu Mar 29 13:56:00 2007 UTC revision 405 by ph10, Mon Mar 23 12:05:20 2009 UTC
# Line 1  Line 1 
1  # CMakeLists.txt  # CMakeLists.txt
2  #  #
3    #
4  # This file allows building PCRE with the CMake configuration and build  # This file allows building PCRE with the CMake configuration and build
5  # tool. Download CMake in source or binary form from http://www.cmake.org/  # tool. Download CMake in source or binary form from http://www.cmake.org/
6  #  #
7  # Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de>  # Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
8  # Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG>  # Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG>
9  #  # 2007-09-14 mod by Sheri so 7.4 supported configuration options can be entered
10    # 2007-09-19 Adjusted by PH to retain previous default settings
11    # 2007-12-26 (a) On UNIX, use names libpcre instead of just pcre
12    #            (b) Ensure pcretest and pcregrep link with the local library,
13    #                not a previously-installed one.
14    #            (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and
15    #                PCRE_SUPPORT_LIBBZ2.
16    # 2008-01-20 Brought up to date to include several new features by Christian
17    #            Ehrlicher.
18    # 2008-01-22 Sheri added options for backward compatibility of library names
19    #            when building with minGW:
20    #            if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to
21    #            be built without "lib" as prefix. (The libraries will be named
22    #            pcre.dll, pcreposix.dll and pcrecpp.dll).
23    #            if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to
24    #            be built with suffix of "-0.dll". (The libraries will be named
25    #            libpcre-0.dll, libpcreposix-0.dll and libpcrecpp-0.dll - same names
26    #            built by default with Configure and Make.
27    # 2008-01-23 PH removed the automatic build of pcredemo.
28    # 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.
29    # 2008-07-03 PH updated for revised UCP property support (change of files)
30    # 2009-03-23 PH applied  Steven Van Ingelgem's patch to change the name
31    #            CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
32    #            is included within another project.
33    
34  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
35    
36  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)
37    
38    SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
39    
40    # external packages
41    FIND_PACKAGE( BZip2 )
42    FIND_PACKAGE( ZLIB )
43    FIND_PACKAGE( Readline )
44    
45  # Configuration checks  # Configuration checks
46    
47  INCLUDE(CheckIncludeFile)  INCLUDE(CheckIncludeFile)
# Line 18  INCLUDE(CheckIncludeFileCXX) Line 49  INCLUDE(CheckIncludeFileCXX)
49  INCLUDE(CheckFunctionExists)  INCLUDE(CheckFunctionExists)
50  INCLUDE(CheckTypeSize)  INCLUDE(CheckTypeSize)
51    
52  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)
53  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
54  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
55  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)
56    CHECK_INCLUDE_FILE(windows.h    HAVE_WINDOWS_H)
57  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)  
58  CHECK_INCLUDE_FILE_CXX(bits/type_traits.h       HAVE_BITS_TYPE_TRAITS_H)  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)
59    CHECK_INCLUDE_FILE_CXX(bits/type_traits.h       HAVE_BITS_TYPE_TRAITS_H)
60  CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)  
61  CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)  CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)
62  CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)  CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)
63    CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)
64    CHECK_FUNCTION_EXISTS(strtoll   HAVE_STRTOLL)
65    CHECK_FUNCTION_EXISTS(strtoq    HAVE_STRTOQ)
66    CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
67    
68  CHECK_TYPE_SIZE("long long"             LONG_LONG)  CHECK_TYPE_SIZE("long long"             LONG_LONG)
69  CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)  CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)
70    
71  # User-configurable options  # User-configurable options
72  #  #
73  # (Note: CMakeSetup displays these in alphabetical order, regardless of  # (Note: CMakeSetup displays these in alphabetical order, regardless of
74  # the order we use here)  # the order we use here)
75    
76  SET(BUILD_SHARED_LIBS "SHARED" CACHE STRING  SET(BUILD_SHARED_LIBS OFF CACHE BOOL
77      "What type of libraries to build. Set to SHARED or STATIC.")      "Build shared libraries instead of static ones.")
78    
79  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
80    
81  SET(PCRE_EBCDIC FALSE CACHE BOOL  SET(PCRE_EBCDIC OFF CACHE BOOL
82      "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)")      "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)")
83    
84  SET(PCRE_LINK_SIZE "2" CACHE STRING  SET(PCRE_LINK_SIZE "2" CACHE STRING
# Line 56  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LI Line 91  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LI
91      "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")      "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")
92    
93  SET(PCRE_NEWLINE "LF" CACHE STRING  SET(PCRE_NEWLINE "LF" CACHE STRING
94      "What to recognize as a newline (one of CR, LF, CRLF, ANY).")      "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
95    
96  SET(PCRE_NO_RECURSE TRUE CACHE BOOL  SET(PCRE_NO_RECURSE OFF CACHE BOOL
97      "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")      "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")
98    
99  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
100      "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")      "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")
101    
102  SET(PCRE_SUPPORT_UNICODE_PROPERTIES FALSE CACHE BOOL  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
103      "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")      "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")
104    
105  SET(PCRE_SUPPORT_UTF8 FALSE CACHE BOOL  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
106      "Enable support for the Unicode UTF-8 encoding.")      "Enable support for the Unicode UTF-8 encoding.")
107    
108    SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
109        "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
110    
111    
112    IF (MINGW)
113      OPTION(NON_STANDARD_LIB_PREFIX
114             "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
115             OFF)
116    
117      OPTION(NON_STANDARD_LIB_SUFFIX
118             "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
119             OFF)
120    ENDIF(MINGW)
121    
122    # bzip2 lib
123    IF(BZIP2_FOUND)
124      OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON)
125    ENDIF(BZIP2_FOUND)
126    IF(PCRE_SUPPORT_LIBBZ2)
127      INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
128    ENDIF(PCRE_SUPPORT_LIBBZ2)
129    
130    # zlib
131    IF(ZLIB_FOUND)
132      OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON)
133    ENDIF(ZLIB_FOUND)
134    IF(PCRE_SUPPORT_LIBZ)
135      INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
136    ENDIF(PCRE_SUPPORT_LIBZ)
137    
138    # readline lib
139    IF(READLINE_FOUND)
140      OPTION (PCRE_SUPPORT_LIBREADLINE  "Enable support for linking pcretest with libreadline." ON)
141    ENDIF(READLINE_FOUND)
142    IF(PCRE_SUPPORT_LIBREADLINE)
143      INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
144    ENDIF(PCRE_SUPPORT_LIBREADLINE)
145    
146  # Prepare build configuration  # Prepare build configuration
147    
148  SET(pcre_have_type_traits 0)  SET(pcre_have_type_traits 0)
149  SET(pcre_have_bits_type_traits 0)  SET(pcre_have_bits_type_traits 0)
150    
151  IF(HAVE_TYPE_TRAITS_H)  IF(HAVE_TYPE_TRAITS_H)
152          SET(pcre_have_type_traits 1)          SET(pcre_have_type_traits 1)
153  ENDIF(HAVE_TYPE_TRAITS_H)  ENDIF(HAVE_TYPE_TRAITS_H)
154    
155  IF(HAVE_BITS_TYPE_TRAITS_H)  IF(HAVE_BITS_TYPE_TRAITS_H)
156          SET(pcre_have_bits_type_traits 1)          SET(pcre_have_bits_type_traits 1)
157  ENDIF(HAVE_BITS_TYPE_TRAITS_H)  ENDIF(HAVE_BITS_TYPE_TRAITS_H)
158    
159  SET(pcre_have_long_long 0)  SET(pcre_have_long_long 0)
160  SET(pcre_have_ulong_long 0)  SET(pcre_have_ulong_long 0)
161    
162  IF(HAVE_LONG_LONG)  IF(HAVE_LONG_LONG)
163          SET(pcre_have_long_long 1)          SET(pcre_have_long_long 1)
164  ENDIF(HAVE_LONG_LONG)  ENDIF(HAVE_LONG_LONG)
165    
166  IF(HAVE_UNSIGNED_LONG_LONG)  IF(HAVE_UNSIGNED_LONG_LONG)
167          SET(pcre_have_ulong_long 1)          SET(pcre_have_ulong_long 1)
168  ENDIF(HAVE_UNSIGNED_LONG_LONG)  ENDIF(HAVE_UNSIGNED_LONG_LONG)
169    
170    IF(NOT BUILD_SHARED_LIBS)
171            SET(PCRE_STATIC 1)
172    ENDIF(NOT BUILD_SHARED_LIBS)
173    
174    IF(PCRE_SUPPORT_BSR_ANYCRLF)
175            SET(BSR_ANYCRLF 1)
176    ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
177    
178  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
179          SET(SUPPORT_UTF8 1)          SET(SUPPORT_UTF8 1)
180  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
181    
182  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
183          SET(SUPPORT_UCP 1)          SET(SUPPORT_UCP 1)
184  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
185    
186    # This next one used to contain
187    #       SET(PCRETEST_LIBS ${READLINE_LIBRARY})
188    # but I was advised to add the NCURSES test as well, along with
189    # some modifications to cmake/FindReadline.cmake which should
190    # make it possible to override the default if necessary. PH
191    
192    IF(PCRE_SUPPORT_LIBREADLINE)
193            SET(SUPPORT_LIBREADLINE 1)
194            SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
195    ENDIF(PCRE_SUPPORT_LIBREADLINE)
196    
197    IF(PCRE_SUPPORT_LIBZ)
198            SET(SUPPORT_LIBZ 1)
199            SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
200    ENDIF(PCRE_SUPPORT_LIBZ)
201    
202    IF(PCRE_SUPPORT_LIBBZ2)
203            SET(SUPPORT_LIBBZ2 1)
204            SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
205    ENDIF(PCRE_SUPPORT_LIBBZ2)
206    
207    SET(NEWLINE "")
208    
209  IF(PCRE_NEWLINE STREQUAL "LF")  IF(PCRE_NEWLINE STREQUAL "LF")
210          SET(NEWLINE "10")          SET(NEWLINE "10")
 ELSEIF(PCRE_NEWLINE STREQUAL "CR")  
         SET(NEWLINE "13")  
 ELSEIF(PCRE_NEWLINE STREQUAL "CRLF")  
         SET(NEWLINE "3338")  
 ELSEIF(PCRE_NEWLINE STREQUAL "ANY")  
         SET(NEWLINE "-1")  
 ELSE(PCRE_NEWLINE STREQUAL "LF")  
         MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\".")  
211  ENDIF(PCRE_NEWLINE STREQUAL "LF")  ENDIF(PCRE_NEWLINE STREQUAL "LF")
212    IF(PCRE_NEWLINE STREQUAL "CR")
213            SET(NEWLINE "13")
214    ENDIF(PCRE_NEWLINE STREQUAL "CR")
215    IF(PCRE_NEWLINE STREQUAL "CRLF")
216            SET(NEWLINE "3338")
217    ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
218    IF(PCRE_NEWLINE STREQUAL "ANY")
219            SET(NEWLINE "-1")
220    ENDIF(PCRE_NEWLINE STREQUAL "ANY")
221    IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
222            SET(NEWLINE "-2")
223    ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
224    
225    IF(NEWLINE STREQUAL "")
226            MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
227    ENDIF(NEWLINE STREQUAL "")
228    
229  IF(PCRE_EBCDIC)  IF(PCRE_EBCDIC)
230          SET(EBCDIC 1)          SET(EBCDIC 1)
231  ENDIF(PCRE_EBCDIC)  ENDIF(PCRE_EBCDIC)
232    
233  IF(PCRE_NO_RECURSE)  IF(PCRE_NO_RECURSE)
234          SET(NO_RECURSE 1)          SET(NO_RECURSE 1)
235  ENDIF(PCRE_NO_RECURSE)  ENDIF(PCRE_NO_RECURSE)
236    
237  # Output files  # Output files
   
238  CONFIGURE_FILE(config-cmake.h.in  CONFIGURE_FILE(config-cmake.h.in
239                 ${CMAKE_BINARY_DIR}/config.h                 ${PROJECT_BINARY_DIR}/config.h
240                 @ONLY)                 @ONLY)
241    
242  CONFIGURE_FILE(pcre.h.generic  CONFIGURE_FILE(pcre.h.generic
243                 ${CMAKE_BINARY_DIR}/pcre.h                 ${PROJECT_BINARY_DIR}/pcre.h
244                 COPYONLY)                 COPYONLY)
245    
246  # What about pcre-config and libpcre.pc?  # What about pcre-config and libpcre.pc?
247    
248  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
249          CONFIGURE_FILE(pcre_stringpiece.h.in          CONFIGURE_FILE(pcre_stringpiece.h.in
250                         ${CMAKE_BINARY_DIR}/pcre_stringpiece.h                         ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
251                         @ONLY)                         @ONLY)
252    
253          CONFIGURE_FILE(pcrecpparg.h.in          CONFIGURE_FILE(pcrecpparg.h.in
254                         ${CMAKE_BINARY_DIR}/pcrecpparg.h                         ${PROJECT_BINARY_DIR}/pcrecpparg.h
255                         @ONLY)                         @ONLY)
256  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
257    
258  # Character table generation  # Character table generation
259    
260  ADD_EXECUTABLE(dftables dftables.c)  OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
261    IF(PCRE_REBUILD_CHARTABLES)
262  GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)    ADD_EXECUTABLE(dftables dftables.c)
263    
264  ADD_CUSTOM_COMMAND(    GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
265          COMMENT "Generating character tables (pcre_chartables.c) for current locale"  
266          DEPENDS dftables    ADD_CUSTOM_COMMAND(
267          COMMAND ${DFTABLES_EXE}      COMMENT "Generating character tables (pcre_chartables.c) for current locale"
268          ARGS    ${CMAKE_BINARY_DIR}/pcre_chartables.c      DEPENDS dftables
269          OUTPUT  ${CMAKE_BINARY_DIR}/pcre_chartables.c      COMMAND ${DFTABLES_EXE}
270  )      ARGS        ${PROJECT_BINARY_DIR}/pcre_chartables.c
271        OUTPUT      ${PROJECT_BINARY_DIR}/pcre_chartables.c
272      )
273    ELSE(PCRE_REBUILD_CHARTABLES)
274      CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
275                        ${PROJECT_BINARY_DIR}/pcre_chartables.c
276                        COPYONLY)
277    ENDIF(PCRE_REBUILD_CHARTABLES)
278    
279  # Source code  # Source code
280    
281  SET(PCRE_HEADERS ${CMAKE_BINARY_DIR}/pcre.h)  SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
282    
283  SET(PCRE_SOURCES  SET(PCRE_SOURCES
284          ${CMAKE_BINARY_DIR}/pcre_chartables.c    ${PROJECT_BINARY_DIR}/pcre_chartables.c
285          pcre_compile.c    pcre_compile.c
286          pcre_config.c    pcre_config.c
287          pcre_dfa_exec.c    pcre_dfa_exec.c
288          pcre_exec.c    pcre_exec.c
289          pcre_fullinfo.c    pcre_fullinfo.c
290          pcre_get.c    pcre_get.c
291          pcre_globals.c    pcre_globals.c
292          pcre_info.c    pcre_info.c
293          pcre_newline.c    pcre_newline.c
294          pcre_maketables.c    pcre_maketables.c
295          pcre_ord2utf8.c    pcre_ord2utf8.c
296          pcre_refcount.c    pcre_refcount.c
297          pcre_study.c    pcre_study.c
298          pcre_tables.c    pcre_tables.c
299          pcre_try_flipped.c    pcre_try_flipped.c
300          pcre_ucp_searchfuncs.c    pcre_ucd.c
301          pcre_valid_utf8.c    pcre_valid_utf8.c
302          pcre_version.c    pcre_version.c
303          pcre_xclass.c    pcre_xclass.c
304  )  )
305    
306  SET(PCREPOSIX_HEADERS pcreposix.h)  SET(PCREPOSIX_HEADERS pcreposix.h)
# Line 190  SET(PCREPOSIX_HEADERS pcreposix.h) Line 308  SET(PCREPOSIX_HEADERS pcreposix.h)
308  SET(PCREPOSIX_SOURCES pcreposix.c)  SET(PCREPOSIX_SOURCES pcreposix.c)
309    
310  SET(PCRECPP_HEADERS  SET(PCRECPP_HEADERS
311          pcrecpp.h    pcrecpp.h
312          pcre_scanner.h    pcre_scanner.h
313          ${CMAKE_BINARY_DIR}/pcrecpparg.h    ${PROJECT_BINARY_DIR}/pcrecpparg.h
314          ${CMAKE_BINARY_DIR}/pcre_stringpiece.h    ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
315  )  )
316    
317  SET(PCRECPP_SOURCES  SET(PCRECPP_SOURCES
318          pcrecpp.cc          pcrecpp.cc
319          pcre_scanner.cc          pcre_scanner.cc
320          pcre_stringpiece.cc          pcre_stringpiece.cc
321  )  )
322    
323  # Build setup  # Build setup
324    
325  ADD_DEFINITIONS(-DHAVE_CONFIG_H)  ADD_DEFINITIONS(-DHAVE_CONFIG_H)
326    
327  IF(WIN32)  IF(MSVC)
328          # What about -DDLL_EXPORT?          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
329          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)  ENDIF(MSVC)
 ENDIF(WIN32)  
330    
331  SET(CMAKE_INCLUDE_CURRENT_DIR 1)  SET(CMAKE_INCLUDE_CURRENT_DIR 1)
332    # needed to make sure to not link debug libs
333  #SET(CMAKE_DEBUG_POSTFIX "d")  # against release libs and vice versa
334    IF(WIN32)
335      SET(CMAKE_DEBUG_POSTFIX "d")
336    ENDIF(WIN32)
337    
338  # Libraries  # Libraries
339    # pcre
340  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES})  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
   
341  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
342  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
343    IF(MINGW AND NOT PCRE_STATIC)
344      IF(NON_STANDARD_LIB_PREFIX)
345        SET_TARGET_PROPERTIES(pcre pcreposix
346                            PROPERTIES PREFIX ""
347        )
348      ENDIF(NON_STANDARD_LIB_PREFIX)
349    
350      IF(NON_STANDARD_LIB_SUFFIX)
351        SET_TARGET_PROPERTIES(pcre pcreposix
352                            PROPERTIES SUFFIX "-0.dll"
353        )
354      ENDIF(NON_STANDARD_LIB_SUFFIX)
355    ENDIF(MINGW AND NOT PCRE_STATIC)
356    
357    
358    # pcrecpp
359  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
360          ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})    ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
361          TARGET_LINK_LIBRARIES(pcrecpp pcre)    TARGET_LINK_LIBRARIES(pcrecpp pcre)
362          IF(MINGW)  
363                  SET_TARGET_PROPERTIES(pcrecpp PROPERTIES PREFIX "mingw-")    IF(MINGW AND NOT PCRE_STATIC)
364          ENDIF(MINGW)      IF(NON_STANDARD_LIB_PREFIX)
365          SET_TARGET_PROPERTIES(pcrecpp
366                                PROPERTIES PREFIX ""
367          )
368        ENDIF(NON_STANDARD_LIB_PREFIX)
369    
370        IF(NON_STANDARD_LIB_SUFFIX)
371          SET_TARGET_PROPERTIES(pcrecpp
372                              PROPERTIES SUFFIX "-0.dll"
373          )
374        ENDIF(NON_STANDARD_LIB_SUFFIX)
375      ENDIF(MINGW AND NOT PCRE_STATIC)
376  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
377    
378    
379  # Executables  # Executables
380    
381  ADD_EXECUTABLE(pcretest pcretest.c)  ADD_EXECUTABLE(pcretest pcretest.c)
382  TARGET_LINK_LIBRARIES(pcretest pcreposix)  TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
383    
384  ADD_EXECUTABLE(pcregrep pcregrep.c)  ADD_EXECUTABLE(pcregrep pcregrep.c)
385  TARGET_LINK_LIBRARIES(pcregrep pcreposix)  TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
386    
387    # Removed by PH (2008-01-23) because pcredemo shouldn't really be built
388    # automatically, and it gave trouble in some environments anyway.
389    # ADD_EXECUTABLE(pcredemo pcredemo.c)
390    # TARGET_LINK_LIBRARIES(pcredemo pcreposix)
391    # IF(NOT BUILD_SHARED_LIBS)
392    #     # make sure to not use declspec(dllimport) in static mode on windows
393    #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
394    # ENDIF(NOT BUILD_SHARED_LIBS)
395    
396    IF(PCRE_BUILD_PCRECPP)
397            ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
398            TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
399    IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
400    SET_TARGET_PROPERTIES(pcrecpp
401                            PROPERTIES PREFIX ""
402    )
403    ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
404    
405    
406            ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
407            TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
408    
409            ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
410            TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
411    ENDIF(PCRE_BUILD_PCRECPP)
412    
413  # Testing  # Testing
414    
415  ENABLE_TESTING()  ENABLE_TESTING()
416    
417    GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
418    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
419    
420    # Write out a CTest configuration file that sets some needed environment
421    # variables for the test scripts.
422    #
423    FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
424    "# This is a generated file.
425    SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})
426    SET(ENV{pcregrep} ${PCREGREP_EXE})
427    SET(ENV{pcretest} ${PCRETEST_EXE})
428    ")
429    
430  IF(UNIX)  IF(UNIX)
431          ADD_TEST(test1 ${CMAKE_SOURCE_DIR}/RunTest srcdir=${CMAKE_SOURCE_DIR})          ADD_TEST(pcre_test      ${PROJECT_SOURCE_DIR}/RunTest)
432  ELSEIF(WIN32)          ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest)
         ADD_TEST(test1 ${CMAKE_SOURCE_DIR}/RunTest.bat ${CMAKE_SOURCE_DIR})  
433  ENDIF(UNIX)  ENDIF(UNIX)
434    IF(WIN32)
435            ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)
436    ENDIF(WIN32)
437    
438    GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
439                        pcrecpp_unittest
440                        DEBUG_LOCATION)
441    
442    GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
443                        pcre_scanner_unittest
444                        DEBUG_LOCATION)
445    
446    GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
447                        pcre_stringpiece_unittest
448                        DEBUG_LOCATION)
449    
450    ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})
451    ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})
452    ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})
453    
454  # Installation  # Installation
455    
# Line 259  INSTALL(TARGETS pcre pcreposix pcregrep Line 462  INSTALL(TARGETS pcre pcreposix pcregrep
462    
463  INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)  INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
464    
465  FILE(GLOB html ${CMAKE_SOURCE_DIR}/doc/html/*.html)  FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
466  FILE(GLOB man1 ${CMAKE_SOURCE_DIR}/doc/*.1)  FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
467  FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)  FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
468    
469  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
470          INSTALL(TARGETS pcrecpp DESTINATION lib)          INSTALL(TARGETS pcrecpp
471          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)                  RUNTIME DESTINATION bin
472                    LIBRARY DESTINATION lib
473                    ARCHIVE DESTINATION lib)
474            INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
475  ELSE(PCRE_BUILD_PCRECPP)  ELSE(PCRE_BUILD_PCRECPP)
476          # Remove pcrecpp.3          # Remove pcrecpp.3
477          FOREACH(man ${man3})          FOREACH(man ${man3})
478                  GET_FILENAME_COMPONENT(man_tmp ${man} NAME)                  GET_FILENAME_COMPONENT(man_tmp ${man} NAME)
479                  IF(NOT man_tmp STREQUAL "pcrecpp.3")                  IF(NOT man_tmp STREQUAL "pcrecpp.3")
480                          SET(man3_new ${man3} ${man})                          SET(man3_new ${man3} ${man})
481                  ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")                  ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")
482          ENDFOREACH(man ${man3})          ENDFOREACH(man ${man3})
483          SET(man3 ${man3_new})          SET(man3 ${man3_new})
484  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
485    
486    
487  INSTALL(FILES ${man1} DESTINATION man/man1)  INSTALL(FILES ${man1} DESTINATION man/man1)
488  INSTALL(FILES ${man3} DESTINATION man/man3)  INSTALL(FILES ${man3} DESTINATION man/man3)
489  INSTALL(FILES ${html} DESTINATION doc/html)  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
490    
491    # help, only for nice output
492    IF(BUILD_SHARED_LIBS)
493      SET(BUILD_STATIC_LIBS OFF)
494    ELSE(BUILD_SHARED_LIBS)
495      SET(BUILD_STATIC_LIBS ON)
496    ENDIF(BUILD_SHARED_LIBS)
497    
498    MESSAGE(STATUS "")
499    MESSAGE(STATUS "")
500    MESSAGE(STATUS "PCRE configuration summary:")
501    MESSAGE(STATUS "")
502    MESSAGE(STATUS "  Install prefix .................. : " ${CMAKE_INSTALL_PREFIX})
503    MESSAGE(STATUS "  C compiler ...................... : " ${CMAKE_C_COMPILER})
504    MESSAGE(STATUS "  C++ compiler .................... : " ${CMAKE_CXX_COMPILER})
505    MESSAGE(STATUS "  C compiler flags ................ : " ${CMAKE_C_FLAGS})   #FIXME
506    MESSAGE(STATUS "  C++ compiler flags .............. : " ${CMAKE_CXX_FLAGS}) #FIXME
507    MESSAGE(STATUS "")
508    MESSAGE(STATUS "  Build C++ library ............... : " ${PCRE_BUILD_PCRECPP})
509    MESSAGE(STATUS "  Enable UTF-8 support ............ : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})
510    MESSAGE(STATUS "  Unicode properties .............. : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})
511    MESSAGE(STATUS "  Newline char/sequence ........... : " ${PCRE_NEWLINE})
512    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : " ${PCRE_SUPPORT_BSR_ANYCRLF})
513    MESSAGE(STATUS "  EBCDIC coding ................... : " ${PCRE_EBCDIC})
514    MESSAGE(STATUS "  Rebuild char tables ............. : " ${PCRE_REBUILD_CHARTABLES})
515    MESSAGE(STATUS "  No stack recursion .............. : " ${PCRE_NO_RECURSE})
516    MESSAGE(STATUS "  POSIX mem threshold ............. : " ${PCRE_POSIX_MALLOC_THRESHOLD})
517    MESSAGE(STATUS "  Internal link size .............. : " ${PCRE_LINK_SIZE})
518    MESSAGE(STATUS "  Match limit ..................... : " ${PCRE_MATCH_LIMIT})
519    MESSAGE(STATUS "  Match limit recursion ........... : " ${PCRE_MATCH_LIMIT_RECURSION})
520    MESSAGE(STATUS "  Build shared libs ............... : " ${BUILD_SHARED_LIBS})
521    MESSAGE(STATUS "  Build static libs ............... : " ${BUILD_STATIC_LIBS})
522    IF(ZLIB_FOUND)
523      MESSAGE(STATUS "  Link pcregrep with libz ......... : " ${PCRE_SUPPORT_LIBZ})
524    ELSE(ZLIB_FOUND)
525      MESSAGE(STATUS "  Link pcregrep with libz ......... : None" )
526    ENDIF(ZLIB_FOUND)
527    IF(BZIP2_FOUND)
528      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : " ${PCRE_SUPPORT_LIBBZ2})
529    ELSE(BZIP2_FOUND)
530      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )
531    ENDIF(BZIP2_FOUND)
532    IF(NOT PCRE_SUPPORT_LIBREADLINE)
533      MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )
534    ELSE(NOT PCRE_SUPPORT_LIBREADLINE)
535      MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})
536    ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
537    IF(MINGW AND NOT PCRE_STATIC)
538      MESSAGE(STATUS "  Non-standard dll names (prefix) . : " ${NON_STANDARD_LIB_PREFIX})
539      MESSAGE(STATUS "  Non-standard dll names (suffix) . : " ${NON_STANDARD_LIB_SUFFIX})
540    ENDIF(MINGW AND NOT PCRE_STATIC)
541    MESSAGE(STATUS "")
542    
543  # end CMakeLists.txt  # end CMakeLists.txt

Legend:
Removed from v.137  
changed lines
  Added in v.405

  ViewVC Help
Powered by ViewVC 1.1.5