/[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 140 by ph10, Fri Mar 30 14:16:42 2007 UTC revision 291 by ph10, Wed Dec 26 18:46:46 2007 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  #  #
17    
18  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
# Line 23  CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_ Line 31  CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_
31  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
32  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
33    
34    CHECK_INCLUDE_FILE(bzlib.h      HAVE_BZLIB_H)
35    CHECK_INCLUDE_FILE(zlib.h       HAVE_ZLIB_H)
36    CHECK_INCLUDE_FILE(readline/history.h  HAVE_READLINE_HISTORY_H)
37    CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_READLINE_H)
38    
39  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)
40  CHECK_INCLUDE_FILE_CXX(bits/type_traits.h       HAVE_BITS_TYPE_TRAITS_H)  CHECK_INCLUDE_FILE_CXX(bits/type_traits.h       HAVE_BITS_TYPE_TRAITS_H)
41    
# Line 38  CHECK_TYPE_SIZE("unsigned long long" UNS Line 51  CHECK_TYPE_SIZE("unsigned long long" UNS
51  # (Note: CMakeSetup displays these in alphabetical order, regardless of  # (Note: CMakeSetup displays these in alphabetical order, regardless of
52  # the order we use here)  # the order we use here)
53    
54  SET(BUILD_SHARED_LIBS "SHARED" CACHE STRING  SET(BUILD_SHARED_LIBS OFF CACHE BOOL
55      "What type of libraries to build. Set to SHARED or STATIC.")      "Build shared libraries instead of static ones.")
56    
57  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
58    
59  SET(PCRE_EBCDIC FALSE CACHE BOOL  SET(PCRE_EBCDIC OFF CACHE BOOL
60      "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)")
61    
62  SET(PCRE_LINK_SIZE "2" CACHE STRING  SET(PCRE_LINK_SIZE "2" CACHE STRING
# Line 56  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LI Line 69  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LI
69      "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.")
70    
71  SET(PCRE_NEWLINE "LF" CACHE STRING  SET(PCRE_NEWLINE "LF" CACHE STRING
72      "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).")
73    
74  SET(PCRE_NO_RECURSE TRUE CACHE BOOL  SET(PCRE_NO_RECURSE OFF CACHE BOOL
75      "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.")
76    
77  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
78      "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.")
79    
80  SET(PCRE_SUPPORT_UNICODE_PROPERTIES FALSE CACHE BOOL  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
81      "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)")
82    
83  SET(PCRE_SUPPORT_UTF8 FALSE CACHE BOOL  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
84      "Enable support for the Unicode UTF-8 encoding.")      "Enable support for the Unicode UTF-8 encoding.")
85    
86    SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
87        "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
88    
89    SET(PCRE_SUPPORT_LIBBZ2 OFF CACHE BOOL
90        "Enable support for linking pcregrep with libbz2.")
91    
92    SET (PCRE_SUPPORT_LIBZ OFF CACHE BOOL
93        "Enable support for linking pcregrep with libz.")
94    
95    SET (PCRE_SUPPORT_LIBREADLINE OFF CACHE BOOL
96        "Enable support for linking pcretest with libreadline.")
97    
98  # Prepare build configuration  # Prepare build configuration
99    
100  SET(pcre_have_type_traits 0)  SET(pcre_have_type_traits 0)
# Line 94  IF(HAVE_UNSIGNED_LONG_LONG) Line 119  IF(HAVE_UNSIGNED_LONG_LONG)
119          SET(pcre_have_ulong_long 1)          SET(pcre_have_ulong_long 1)
120  ENDIF(HAVE_UNSIGNED_LONG_LONG)  ENDIF(HAVE_UNSIGNED_LONG_LONG)
121    
122    IF(NOT BUILD_SHARED_LIBS)
123            SET(PCRE_STATIC 1)
124    ENDIF(NOT BUILD_SHARED_LIBS)
125    
126    IF(PCRE_SUPPORT_BSR_ANYCRLF)
127            SET(BSR_ANYCRLF 1)
128    ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
129    
130  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
131          SET(SUPPORT_UTF8 1)          SET(SUPPORT_UTF8 1)
132  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
# Line 102  IF(PCRE_SUPPORT_UNICODE_PROPERTIES) Line 135  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
135          SET(SUPPORT_UCP 1)          SET(SUPPORT_UCP 1)
136  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
137    
138    IF(PCRE_SUPPORT_LIBREADLINE)
139            SET(SUPPORT_LIBREADLINE 1)
140            SET(PCRETEST_LIBS readline)
141    ENDIF(PCRE_SUPPORT_LIBREADLINE)
142    
143    IF(PCRE_SUPPORT_LIBZ)
144            SET(SUPPORT_LIBZ 1)
145            SET(PCREGREP_LIBS z)
146    ENDIF(PCRE_SUPPORT_LIBZ)
147    
148    IF(PCRE_SUPPORT_LIBBZ2)
149            SET(SUPPORT_LIBBZ2 1)
150            SET(PCREGREP_LIBS ${PCREGREP_LIBS} bz2)
151    ENDIF(PCRE_SUPPORT_LIBBZ2)
152    
153    SET(NEWLINE "")
154    
155  IF(PCRE_NEWLINE STREQUAL "LF")  IF(PCRE_NEWLINE STREQUAL "LF")
156    SET(NEWLINE "10")          SET(NEWLINE "10")
 ELSE(PCRE_NEWLINE STREQUAL "LF")  
   IF(PCRE_NEWLINE STREQUAL "CR")  
     SET(NEWLINE "13")  
   ELSE(PCRE_NEWLINE STREQUAL "CR")  
     IF(PCRE_NEWLINE STREQUAL "CRLF")  
       SET(NEWLINE "3338")  
     ELSE(PCRE_NEWLINE STREQUAL "CRLF")  
       IF(PCRE_NEWLINE STREQUAL "ANY")  
         SET(NEWLINE "-1")  
       ELSE(PCRE_NEWLINE STREQUAL "ANY")  
         MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\".")  
       ENDIF(PCRE_NEWLINE STREQUAL "ANY")  
     ENDIF(PCRE_NEWLINE STREQUAL "CRLF")  
   ENDIF(PCRE_NEWLINE STREQUAL "CR")  
157  ENDIF(PCRE_NEWLINE STREQUAL "LF")  ENDIF(PCRE_NEWLINE STREQUAL "LF")
158    IF(PCRE_NEWLINE STREQUAL "CR")
159            SET(NEWLINE "13")
160    ENDIF(PCRE_NEWLINE STREQUAL "CR")
161    IF(PCRE_NEWLINE STREQUAL "CRLF")
162            SET(NEWLINE "3338")
163    ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
164    IF(PCRE_NEWLINE STREQUAL "ANY")
165            SET(NEWLINE "-1")
166    ENDIF(PCRE_NEWLINE STREQUAL "ANY")
167    IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
168            SET(NEWLINE "-2")
169    ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
170    
171    IF(NEWLINE STREQUAL "")
172            MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
173    ENDIF(NEWLINE STREQUAL "")
174    
175  IF(PCRE_EBCDIC)  IF(PCRE_EBCDIC)
176          SET(EBCDIC 1)          SET(EBCDIC 1)
# Line 213  SET(PCRECPP_SOURCES Line 265  SET(PCRECPP_SOURCES
265  ADD_DEFINITIONS(-DHAVE_CONFIG_H)  ADD_DEFINITIONS(-DHAVE_CONFIG_H)
266    
267  IF(WIN32)  IF(WIN32)
         # What about -DDLL_EXPORT?  
268          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
269  ENDIF(WIN32)  ENDIF(WIN32)
270    
# Line 228  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_ Line 279  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_
279  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
280  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
281    
282    IF(NOT UNIX)
283    SET_TARGET_PROPERTIES(pcre pcreposix
284                            PROPERTIES PREFIX ""
285    )
286    ENDIF(NOT UNIX)
287    
288  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
289          ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})          ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
290          TARGET_LINK_LIBRARIES(pcrecpp pcre)          TARGET_LINK_LIBRARIES(pcrecpp pcre)
# Line 239  ENDIF(PCRE_BUILD_PCRECPP) Line 296  ENDIF(PCRE_BUILD_PCRECPP)
296  # Executables  # Executables
297    
298  ADD_EXECUTABLE(pcretest pcretest.c)  ADD_EXECUTABLE(pcretest pcretest.c)
299  TARGET_LINK_LIBRARIES(pcretest pcreposix)  TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
300    
301  ADD_EXECUTABLE(pcregrep pcregrep.c)  ADD_EXECUTABLE(pcregrep pcregrep.c)
302  TARGET_LINK_LIBRARIES(pcregrep pcreposix)  TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
303    
304    IF(PCRE_BUILD_PCRECPP)
305            ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
306            TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
307    
308            ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
309            TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
310    
311            ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
312            TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
313    ENDIF(PCRE_BUILD_PCRECPP)
314    
315  # Testing  # Testing
316    
317  ENABLE_TESTING()  ENABLE_TESTING()
318    
319    GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
320    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
321    
322    # Write out a CTest configuration file that sets some needed environment
323    # variables for the test scripts.
324    #
325    FILE(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.ctest
326    "# This is a generated file.
327    SET(ENV{srcdir} ${CMAKE_SOURCE_DIR})
328    SET(ENV{pcregrep} ${PCREGREP_EXE})
329    SET(ENV{pcretest} ${PCRETEST_EXE})
330    ")
331    
332  IF(UNIX)  IF(UNIX)
333          ADD_TEST(test1 sh -c "srcdir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/RunTest")          ADD_TEST(pcre_test      ${CMAKE_SOURCE_DIR}/RunTest)
334          ADD_TEST(test2 sh -c "srcdir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/RunGrepTest")          ADD_TEST(pcre_grep_test ${CMAKE_SOURCE_DIR}/RunGrepTest)
 ELSE(UNIX)  
   IF(WIN32)  
         ADD_TEST(test1 ${CMAKE_SOURCE_DIR}/RunTest.bat ${CMAKE_SOURCE_DIR})  
   ENDIF(WIN32)  
335  ENDIF(UNIX)  ENDIF(UNIX)
336    IF(WIN32)
337            ADD_TEST(pcre_test cmd /C ${CMAKE_SOURCE_DIR}/RunTest.bat)
338    ENDIF(WIN32)
339    
340    GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
341                        pcrecpp_unittest
342                        DEBUG_LOCATION)
343    
344    GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
345                        pcre_scanner_unittest
346                        DEBUG_LOCATION)
347    
348    GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
349                        pcre_stringpiece_unittest
350                        DEBUG_LOCATION)
351    
352    ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})
353    ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})
354    ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})
355    
356  # Installation  # Installation
357    
# Line 273  FILE(GLOB man1 ${CMAKE_SOURCE_DIR}/doc/* Line 369  FILE(GLOB man1 ${CMAKE_SOURCE_DIR}/doc/*
369  FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)  FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)
370    
371  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
372          INSTALL(TARGETS pcrecpp DESTINATION lib)          INSTALL(TARGETS pcrecpp
373                    RUNTIME DESTINATION bin
374                    LIBRARY DESTINATION lib
375                    ARCHIVE DESTINATION lib)
376          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
377  ELSE(PCRE_BUILD_PCRECPP)  ELSE(PCRE_BUILD_PCRECPP)
378          # Remove pcrecpp.3          # Remove pcrecpp.3
# Line 288  ENDIF(PCRE_BUILD_PCRECPP) Line 387  ENDIF(PCRE_BUILD_PCRECPP)
387    
388  INSTALL(FILES ${man1} DESTINATION man/man1)  INSTALL(FILES ${man1} DESTINATION man/man1)
389  INSTALL(FILES ${man3} DESTINATION man/man3)  INSTALL(FILES ${man3} DESTINATION man/man3)
390  INSTALL(FILES ${html} DESTINATION doc/html)  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
391    
392  # end CMakeLists.txt  # end CMakeLists.txt

Legend:
Removed from v.140  
changed lines
  Added in v.291

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12