/[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 258 by ph10, Wed Sep 19 09:27:50 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  #  #
12    
13  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
# Line 38  CHECK_TYPE_SIZE("unsigned long long"   UNS Line 41  CHECK_TYPE_SIZE("unsigned long long"   UNS
41  # (Note: CMakeSetup displays these in alphabetical order, regardless of  # (Note: CMakeSetup displays these in alphabetical order, regardless of
42  # the order we use here)  # the order we use here)
43    
44  SET(BUILD_SHARED_LIBS "SHARED" CACHE STRING  SET(BUILD_SHARED_LIBS OFF CACHE BOOL
45      "What type of libraries to build. Set to SHARED or STATIC.")      "Build shared libraries instead of static ones.")
46    
47  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
48    
49  SET(PCRE_EBCDIC FALSE CACHE BOOL  SET(PCRE_EBCDIC OFF CACHE BOOL
50      "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)")
51    
52  SET(PCRE_LINK_SIZE "2" CACHE STRING  SET(PCRE_LINK_SIZE "2" CACHE STRING
# Line 56  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LI Line 59  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LI
59      "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.")
60    
61  SET(PCRE_NEWLINE "LF" CACHE STRING  SET(PCRE_NEWLINE "LF" CACHE STRING
62      "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).")
63    
64  SET(PCRE_NO_RECURSE TRUE CACHE BOOL  SET(PCRE_NO_RECURSE OFF CACHE BOOL
65      "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.")
66    
67  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
68      "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.")
69    
70  SET(PCRE_SUPPORT_UNICODE_PROPERTIES FALSE CACHE BOOL  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
71      "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)")
72    
73  SET(PCRE_SUPPORT_UTF8 FALSE CACHE BOOL  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
74      "Enable support for the Unicode UTF-8 encoding.")      "Enable support for the Unicode UTF-8 encoding.")
75    
76    SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
77        "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
78    
79  # Prepare build configuration  # Prepare build configuration
80    
81  SET(pcre_have_type_traits 0)  SET(pcre_have_type_traits 0)
# Line 94  IF(HAVE_UNSIGNED_LONG_LONG) Line 100  IF(HAVE_UNSIGNED_LONG_LONG)
100          SET(pcre_have_ulong_long 1)          SET(pcre_have_ulong_long 1)
101  ENDIF(HAVE_UNSIGNED_LONG_LONG)  ENDIF(HAVE_UNSIGNED_LONG_LONG)
102    
103    IF(NOT BUILD_SHARED_LIBS)
104            SET(PCRE_STATIC 1)
105    ENDIF(NOT BUILD_SHARED_LIBS)
106    
107    IF(PCRE_SUPPORT_BSR_ANYCRLF)
108            SET(BSR_ANYCRLF 1)
109    ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
110    
111  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
112          SET(SUPPORT_UTF8 1)          SET(SUPPORT_UTF8 1)
113  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 116  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
116          SET(SUPPORT_UCP 1)          SET(SUPPORT_UCP 1)
117  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
118    
119    SET(NEWLINE "")
120    
121  IF(PCRE_NEWLINE STREQUAL "LF")  IF(PCRE_NEWLINE STREQUAL "LF")
122          SET(NEWLINE "10")          SET(NEWLINE "10")
123  ELSEIF(PCRE_NEWLINE STREQUAL "CR")  ENDIF(PCRE_NEWLINE STREQUAL "LF")
124    IF(PCRE_NEWLINE STREQUAL "CR")
125          SET(NEWLINE "13")          SET(NEWLINE "13")
126  ELSEIF(PCRE_NEWLINE STREQUAL "CRLF")  ENDIF(PCRE_NEWLINE STREQUAL "CR")
127    IF(PCRE_NEWLINE STREQUAL "CRLF")
128          SET(NEWLINE "3338")          SET(NEWLINE "3338")
129  ELSEIF(PCRE_NEWLINE STREQUAL "ANY")  ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
130    IF(PCRE_NEWLINE STREQUAL "ANY")
131          SET(NEWLINE "-1")          SET(NEWLINE "-1")
132  ELSE(PCRE_NEWLINE STREQUAL "LF")  ENDIF(PCRE_NEWLINE STREQUAL "ANY")
133          MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\".")  IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
134  ENDIF(PCRE_NEWLINE STREQUAL "LF")          SET(NEWLINE "-2")
135    ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
136    
137    IF(NEWLINE STREQUAL "")
138            MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
139    ENDIF(NEWLINE STREQUAL "")
140    
141  IF(PCRE_EBCDIC)  IF(PCRE_EBCDIC)
142          SET(EBCDIC 1)          SET(EBCDIC 1)
# Line 136  CONFIGURE_FILE(pcre.h.generic Line 160  CONFIGURE_FILE(pcre.h.generic
160    
161  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
162          CONFIGURE_FILE(pcre_stringpiece.h.in          CONFIGURE_FILE(pcre_stringpiece.h.in
163                         ${CMAKE_BINARY_DIR}/pcre_stringpiece.h                         ${CMAKE_BINARY_DIR}/pcre_stringpiece.h
164                         @ONLY)                         @ONLY)
165    
166          CONFIGURE_FILE(pcrecpparg.h.in          CONFIGURE_FILE(pcrecpparg.h.in
167                         ${CMAKE_BINARY_DIR}/pcrecpparg.h                         ${CMAKE_BINARY_DIR}/pcrecpparg.h
168                         @ONLY)                         @ONLY)
169  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
170    
171  # Character table generation  # Character table generation
# Line 154  ADD_CUSTOM_COMMAND( Line 178  ADD_CUSTOM_COMMAND(
178          COMMENT "Generating character tables (pcre_chartables.c) for current locale"          COMMENT "Generating character tables (pcre_chartables.c) for current locale"
179          DEPENDS dftables          DEPENDS dftables
180          COMMAND ${DFTABLES_EXE}          COMMAND ${DFTABLES_EXE}
181          ARGS    ${CMAKE_BINARY_DIR}/pcre_chartables.c          ARGS    ${CMAKE_BINARY_DIR}/pcre_chartables.c
182          OUTPUT  ${CMAKE_BINARY_DIR}/pcre_chartables.c          OUTPUT  ${CMAKE_BINARY_DIR}/pcre_chartables.c
183  )  )
184    
185  # Source code  # Source code
# Line 207  SET(PCRECPP_SOURCES Line 231  SET(PCRECPP_SOURCES
231  ADD_DEFINITIONS(-DHAVE_CONFIG_H)  ADD_DEFINITIONS(-DHAVE_CONFIG_H)
232    
233  IF(WIN32)  IF(WIN32)
         # What about -DDLL_EXPORT?  
234          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
235  ENDIF(WIN32)  ENDIF(WIN32)
236    
# Line 222  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_ Line 245  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_
245  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
246  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
247    
248    SET_TARGET_PROPERTIES(pcre pcreposix
249                            PROPERTIES PREFIX ""
250    )
251    
252  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
253          ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})          ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
254          TARGET_LINK_LIBRARIES(pcrecpp pcre)          TARGET_LINK_LIBRARIES(pcrecpp pcre)
# Line 238  TARGET_LINK_LIBRARIES(pcretest pcreposix Line 265  TARGET_LINK_LIBRARIES(pcretest pcreposix
265  ADD_EXECUTABLE(pcregrep pcregrep.c)  ADD_EXECUTABLE(pcregrep pcregrep.c)
266  TARGET_LINK_LIBRARIES(pcregrep pcreposix)  TARGET_LINK_LIBRARIES(pcregrep pcreposix)
267    
268    IF(PCRE_BUILD_PCRECPP)
269            ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
270            TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
271    
272            ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
273            TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
274    
275            ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
276            TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
277    ENDIF(PCRE_BUILD_PCRECPP)
278    
279  # Testing  # Testing
280    
281  ENABLE_TESTING()  ENABLE_TESTING()
282    
283    GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
284    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
285    
286    # Write out a CTest configuration file that sets some needed environment
287    # variables for the test scripts.
288    #
289    FILE(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.ctest
290    "# This is a generated file.
291    SET(ENV{srcdir} ${CMAKE_SOURCE_DIR})
292    SET(ENV{pcregrep} ${PCREGREP_EXE})
293    SET(ENV{pcretest} ${PCRETEST_EXE})
294    ")
295    
296  IF(UNIX)  IF(UNIX)
297          ADD_TEST(test1 ${CMAKE_SOURCE_DIR}/RunTest srcdir=${CMAKE_SOURCE_DIR})          ADD_TEST(pcre_test      ${CMAKE_SOURCE_DIR}/RunTest)
298  ELSEIF(WIN32)          ADD_TEST(pcre_grep_test ${CMAKE_SOURCE_DIR}/RunGrepTest)
         ADD_TEST(test1 ${CMAKE_SOURCE_DIR}/RunTest.bat ${CMAKE_SOURCE_DIR})  
299  ENDIF(UNIX)  ENDIF(UNIX)
300    IF(WIN32)
301            ADD_TEST(pcre_test cmd /C ${CMAKE_SOURCE_DIR}/RunTest.bat)
302    ENDIF(WIN32)
303    
304    GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
305                        pcrecpp_unittest
306                        DEBUG_LOCATION)
307    
308    GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
309                        pcre_scanner_unittest
310                        DEBUG_LOCATION)
311    
312    GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
313                        pcre_stringpiece_unittest
314                        DEBUG_LOCATION)
315    
316    ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})
317    ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})
318    ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})
319    
320  # Installation  # Installation
321    
# Line 264  FILE(GLOB man1 ${CMAKE_SOURCE_DIR}/doc/* Line 333  FILE(GLOB man1 ${CMAKE_SOURCE_DIR}/doc/*
333  FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)  FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)
334    
335  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
336          INSTALL(TARGETS pcrecpp DESTINATION lib)          INSTALL(TARGETS pcrecpp
337                    RUNTIME DESTINATION bin
338                    LIBRARY DESTINATION lib
339                    ARCHIVE DESTINATION lib)
340          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
341  ELSE(PCRE_BUILD_PCRECPP)  ELSE(PCRE_BUILD_PCRECPP)
342          # Remove pcrecpp.3          # Remove pcrecpp.3
# Line 279  ENDIF(PCRE_BUILD_PCRECPP) Line 351  ENDIF(PCRE_BUILD_PCRECPP)
351    
352  INSTALL(FILES ${man1} DESTINATION man/man1)  INSTALL(FILES ${man1} DESTINATION man/man1)
353  INSTALL(FILES ${man3} DESTINATION man/man3)  INSTALL(FILES ${man3} DESTINATION man/man3)
354  INSTALL(FILES ${html} DESTINATION doc/html)  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
355    
356  # end CMakeLists.txt  # end CMakeLists.txt

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

  ViewVC Help
Powered by ViewVC 1.1.5