/[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 311 by ph10, Wed Jan 23 17:34:58 2008 UTC revision 411 by ph10, Fri Apr 10 15:40:21 2009 UTC
# Line 15  Line 15 
15  #                PCRE_SUPPORT_LIBBZ2.  #                PCRE_SUPPORT_LIBBZ2.
16  # 2008-01-20 Brought up to date to include several new features by Christian  # 2008-01-20 Brought up to date to include several new features by Christian
17  #            Ehrlicher.  #            Ehrlicher.
18  # 2008-01-22 Sheri aded options for backward compatibility of library names when  # 2008-01-22 Sheri added options for backward compatibility of library names
19  #            building with minGW:  #            when building with minGW:
20  #            if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to  #            if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to
21  #            be built without "lib" as prefix. (The libraries will be named pcre.dll,  #            be built without "lib" as prefix. (The libraries will be named
22  #            pcreposix.dll and pcrecpp.dll).  #            pcre.dll, pcreposix.dll and pcrecpp.dll).
23  #            if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to  #            if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to
24  #            be built with suffix of "-0.dll". (The libraries will be named  #            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  #            libpcre-0.dll, libpcreposix-0.dll and libpcrecpp-0.dll - same names
26  #            built by default with Configure and Make.  #            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    # 2009-03-23 PH applied a modified version of Steven Van Ingelgem's patches to
34    #            add options to stop the building of pcregrep and the tests, and
35    #            to disable the final configuration report.
36    
37  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
38    
39  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)
40    
41  SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # for FindReadline.cmake  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
42    
43  # external packages  # external packages
44  FIND_PACKAGE( BZip2 )  FIND_PACKAGE( BZip2 )
# Line 43  INCLUDE(CheckIncludeFileCXX) Line 52  INCLUDE(CheckIncludeFileCXX)
52  INCLUDE(CheckFunctionExists)  INCLUDE(CheckFunctionExists)
53  INCLUDE(CheckTypeSize)  INCLUDE(CheckTypeSize)
54    
55  CHECK_INCLUDE_FILE(dirent.h         HAVE_DIRENT_H)  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)
56  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
57  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
58  CHECK_INCLUDE_FILE(unistd.h         HAVE_UNISTD_H)  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)
59  CHECK_INCLUDE_FILE(windows.h    HAVE_WINDOWS_H)  CHECK_INCLUDE_FILE(windows.h    HAVE_WINDOWS_H)
60    
61  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)
62  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)
63    
64  CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)  CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)
65  CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)  CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)
66  CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)  CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)
67  CHECK_FUNCTION_EXISTS(strtoll   HAVE_STRTOLL)  CHECK_FUNCTION_EXISTS(strtoll   HAVE_STRTOLL)
68  CHECK_FUNCTION_EXISTS(strtoq    HAVE_STRTOQ)  CHECK_FUNCTION_EXISTS(strtoq    HAVE_STRTOQ)
69  CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)  CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
70    
71  CHECK_TYPE_SIZE("long long"             LONG_LONG)  CHECK_TYPE_SIZE("long long"             LONG_LONG)
72  CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)  CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)
73    
74  # User-configurable options  # User-configurable options
75  #  #
# Line 102  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL Line 111  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
111  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
112      "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")      "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
113    
114  SET(NON_STANDARD_LIB_PREFIX OFF CACHE BOOL  OPTION(PCRE_SHOW_REPORT    "Show the final configuration report" ON)
115     "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc.")  OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
116    OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)
117  SET(NON_STANDARD_LIB_SUFFIX OFF CACHE BOOL  
118     "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc.")  IF (PCRE_BUILD_TESTS)
119      IF (NOT PCRE_BUILD_PCREGREP)
120        MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON")
121        SET(PCRE_BUILD_PCREGREP ON)
122      ENDIF(NOT PCRE_BUILD_PCREGREP)
123    ENDIF(PCRE_BUILD_TESTS)
124    
125    IF (MINGW)
126      OPTION(NON_STANDARD_LIB_PREFIX
127             "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
128             OFF)
129    
130      OPTION(NON_STANDARD_LIB_SUFFIX
131             "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
132             OFF)
133    ENDIF(MINGW)
134    
135  # bzip2 lib  # bzip2 lib
136  IF(BZIP2_FOUND)  IF(BZIP2_FOUND)
# Line 138  SET(pcre_have_type_traits 0) Line 162  SET(pcre_have_type_traits 0)
162  SET(pcre_have_bits_type_traits 0)  SET(pcre_have_bits_type_traits 0)
163    
164  IF(HAVE_TYPE_TRAITS_H)  IF(HAVE_TYPE_TRAITS_H)
165          SET(pcre_have_type_traits 1)          SET(pcre_have_type_traits 1)
166  ENDIF(HAVE_TYPE_TRAITS_H)  ENDIF(HAVE_TYPE_TRAITS_H)
167    
168  IF(HAVE_BITS_TYPE_TRAITS_H)  IF(HAVE_BITS_TYPE_TRAITS_H)
169          SET(pcre_have_bits_type_traits 1)          SET(pcre_have_bits_type_traits 1)
170  ENDIF(HAVE_BITS_TYPE_TRAITS_H)  ENDIF(HAVE_BITS_TYPE_TRAITS_H)
171    
172  SET(pcre_have_long_long 0)  SET(pcre_have_long_long 0)
173  SET(pcre_have_ulong_long 0)  SET(pcre_have_ulong_long 0)
174    
175  IF(HAVE_LONG_LONG)  IF(HAVE_LONG_LONG)
176          SET(pcre_have_long_long 1)          SET(pcre_have_long_long 1)
177  ENDIF(HAVE_LONG_LONG)  ENDIF(HAVE_LONG_LONG)
178    
179  IF(HAVE_UNSIGNED_LONG_LONG)  IF(HAVE_UNSIGNED_LONG_LONG)
180          SET(pcre_have_ulong_long 1)          SET(pcre_have_ulong_long 1)
181  ENDIF(HAVE_UNSIGNED_LONG_LONG)  ENDIF(HAVE_UNSIGNED_LONG_LONG)
182    
183  IF(NOT BUILD_SHARED_LIBS)  IF(NOT BUILD_SHARED_LIBS)
184          SET(PCRE_STATIC 1)          SET(PCRE_STATIC 1)
185  ENDIF(NOT BUILD_SHARED_LIBS)  ENDIF(NOT BUILD_SHARED_LIBS)
186    
187  IF(PCRE_SUPPORT_BSR_ANYCRLF)  IF(PCRE_SUPPORT_BSR_ANYCRLF)
188          SET(BSR_ANYCRLF 1)          SET(BSR_ANYCRLF 1)
189  ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)  ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
190    
191  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
192          SET(SUPPORT_UTF8 1)          SET(SUPPORT_UTF8 1)
193  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
194    
195  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
196          SET(SUPPORT_UCP 1)          SET(SUPPORT_UCP 1)
197  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
198    
199    # This next one used to contain
200    #       SET(PCRETEST_LIBS ${READLINE_LIBRARY})
201    # but I was advised to add the NCURSES test as well, along with
202    # some modifications to cmake/FindReadline.cmake which should
203    # make it possible to override the default if necessary. PH
204    
205  IF(PCRE_SUPPORT_LIBREADLINE)  IF(PCRE_SUPPORT_LIBREADLINE)
206          SET(SUPPORT_LIBREADLINE 1)          SET(SUPPORT_LIBREADLINE 1)
207          SET(PCRETEST_LIBS ${READLINE_LIBRARY})          SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
208  ENDIF(PCRE_SUPPORT_LIBREADLINE)  ENDIF(PCRE_SUPPORT_LIBREADLINE)
209    
210  IF(PCRE_SUPPORT_LIBZ)  IF(PCRE_SUPPORT_LIBZ)
# Line 190  ENDIF(PCRE_SUPPORT_LIBBZ2) Line 220  ENDIF(PCRE_SUPPORT_LIBBZ2)
220  SET(NEWLINE "")  SET(NEWLINE "")
221    
222  IF(PCRE_NEWLINE STREQUAL "LF")  IF(PCRE_NEWLINE STREQUAL "LF")
223          SET(NEWLINE "10")          SET(NEWLINE "10")
224  ENDIF(PCRE_NEWLINE STREQUAL "LF")  ENDIF(PCRE_NEWLINE STREQUAL "LF")
225  IF(PCRE_NEWLINE STREQUAL "CR")  IF(PCRE_NEWLINE STREQUAL "CR")
226          SET(NEWLINE "13")          SET(NEWLINE "13")
227  ENDIF(PCRE_NEWLINE STREQUAL "CR")  ENDIF(PCRE_NEWLINE STREQUAL "CR")
228  IF(PCRE_NEWLINE STREQUAL "CRLF")  IF(PCRE_NEWLINE STREQUAL "CRLF")
229          SET(NEWLINE "3338")          SET(NEWLINE "3338")
230  ENDIF(PCRE_NEWLINE STREQUAL "CRLF")  ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
231  IF(PCRE_NEWLINE STREQUAL "ANY")  IF(PCRE_NEWLINE STREQUAL "ANY")
232          SET(NEWLINE "-1")          SET(NEWLINE "-1")
233  ENDIF(PCRE_NEWLINE STREQUAL "ANY")  ENDIF(PCRE_NEWLINE STREQUAL "ANY")
234  IF(PCRE_NEWLINE STREQUAL "ANYCRLF")  IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
235          SET(NEWLINE "-2")          SET(NEWLINE "-2")
236  ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")  ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
237    
238  IF(NEWLINE STREQUAL "")  IF(NEWLINE STREQUAL "")
239          MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")          MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
240  ENDIF(NEWLINE STREQUAL "")  ENDIF(NEWLINE STREQUAL "")
241    
242  IF(PCRE_EBCDIC)  IF(PCRE_EBCDIC)
243          SET(EBCDIC 1)          SET(EBCDIC 1)
244  ENDIF(PCRE_EBCDIC)  ENDIF(PCRE_EBCDIC)
245    
246  IF(PCRE_NO_RECURSE)  IF(PCRE_NO_RECURSE)
247          SET(NO_RECURSE 1)          SET(NO_RECURSE 1)
248  ENDIF(PCRE_NO_RECURSE)  ENDIF(PCRE_NO_RECURSE)
249    
250  # Output files  # Output files
   
251  CONFIGURE_FILE(config-cmake.h.in  CONFIGURE_FILE(config-cmake.h.in
252                 ${CMAKE_BINARY_DIR}/config.h                 ${PROJECT_BINARY_DIR}/config.h
253                 @ONLY)                 @ONLY)
254    
255  CONFIGURE_FILE(pcre.h.generic  CONFIGURE_FILE(pcre.h.generic
256                 ${CMAKE_BINARY_DIR}/pcre.h                 ${PROJECT_BINARY_DIR}/pcre.h
257                 COPYONLY)                 COPYONLY)
258    
259  # What about pcre-config and libpcre.pc?  # What about pcre-config and libpcre.pc?
260    
261  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
262          CONFIGURE_FILE(pcre_stringpiece.h.in          CONFIGURE_FILE(pcre_stringpiece.h.in
263                         ${CMAKE_BINARY_DIR}/pcre_stringpiece.h                         ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
264                         @ONLY)                         @ONLY)
265    
266          CONFIGURE_FILE(pcrecpparg.h.in          CONFIGURE_FILE(pcrecpparg.h.in
267                         ${CMAKE_BINARY_DIR}/pcrecpparg.h                         ${PROJECT_BINARY_DIR}/pcrecpparg.h
268                         @ONLY)                         @ONLY)
269  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
270    
271  # Character table generation  # Character table generation
# Line 251  IF(PCRE_REBUILD_CHARTABLES) Line 280  IF(PCRE_REBUILD_CHARTABLES)
280      COMMENT "Generating character tables (pcre_chartables.c) for current locale"      COMMENT "Generating character tables (pcre_chartables.c) for current locale"
281      DEPENDS dftables      DEPENDS dftables
282      COMMAND ${DFTABLES_EXE}      COMMAND ${DFTABLES_EXE}
283      ARGS        ${CMAKE_BINARY_DIR}/pcre_chartables.c      ARGS        ${PROJECT_BINARY_DIR}/pcre_chartables.c
284      OUTPUT      ${CMAKE_BINARY_DIR}/pcre_chartables.c      OUTPUT      ${PROJECT_BINARY_DIR}/pcre_chartables.c
285    )    )
286  ELSE(PCRE_REBUILD_CHARTABLES)  ELSE(PCRE_REBUILD_CHARTABLES)
287    CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pcre_chartables.c.dist    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
288                      ${CMAKE_BINARY_DIR}/pcre_chartables.c                      ${PROJECT_BINARY_DIR}/pcre_chartables.c
289                      COPYONLY)                      COPYONLY)
290  ENDIF(PCRE_REBUILD_CHARTABLES)  ENDIF(PCRE_REBUILD_CHARTABLES)
291    
292  # Source code  # Source code
293    
294  SET(PCRE_HEADERS ${CMAKE_BINARY_DIR}/pcre.h)  SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
295    
296  SET(PCRE_SOURCES  SET(PCRE_SOURCES
297    ${CMAKE_BINARY_DIR}/pcre_chartables.c    ${PROJECT_BINARY_DIR}/pcre_chartables.c
298    pcre_compile.c    pcre_compile.c
299    pcre_config.c    pcre_config.c
300    pcre_dfa_exec.c    pcre_dfa_exec.c
# Line 281  SET(PCRE_SOURCES Line 310  SET(PCRE_SOURCES
310    pcre_study.c    pcre_study.c
311    pcre_tables.c    pcre_tables.c
312    pcre_try_flipped.c    pcre_try_flipped.c
313    pcre_ucp_searchfuncs.c    pcre_ucd.c
314    pcre_valid_utf8.c    pcre_valid_utf8.c
315    pcre_version.c    pcre_version.c
316    pcre_xclass.c    pcre_xclass.c
# Line 294  SET(PCREPOSIX_SOURCES pcreposix.c) Line 323  SET(PCREPOSIX_SOURCES pcreposix.c)
323  SET(PCRECPP_HEADERS  SET(PCRECPP_HEADERS
324    pcrecpp.h    pcrecpp.h
325    pcre_scanner.h    pcre_scanner.h
326    ${CMAKE_BINARY_DIR}/pcrecpparg.h    ${PROJECT_BINARY_DIR}/pcrecpparg.h
327    ${CMAKE_BINARY_DIR}/pcre_stringpiece.h    ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
328  )  )
329    
330  SET(PCRECPP_SOURCES  SET(PCRECPP_SOURCES
331          pcrecpp.cc          pcrecpp.cc
332          pcre_scanner.cc          pcre_scanner.cc
333          pcre_stringpiece.cc          pcre_stringpiece.cc
334  )  )
335    
336  # Build setup  # Build setup
# Line 309  SET(PCRECPP_SOURCES Line 338  SET(PCRECPP_SOURCES
338  ADD_DEFINITIONS(-DHAVE_CONFIG_H)  ADD_DEFINITIONS(-DHAVE_CONFIG_H)
339    
340  IF(MSVC)  IF(MSVC)
341          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
342  ENDIF(MSVC)  ENDIF(MSVC)
343    
344  SET(CMAKE_INCLUDE_CURRENT_DIR 1)  SET(CMAKE_INCLUDE_CURRENT_DIR 1)
# Line 319  IF(WIN32) Line 348  IF(WIN32)
348    SET(CMAKE_DEBUG_POSTFIX "d")    SET(CMAKE_DEBUG_POSTFIX "d")
349  ENDIF(WIN32)  ENDIF(WIN32)
350    
351  # Libraries  SET(targets)
352    
353  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${CMAKE_BINARY_DIR}/config.h)  # Libraries
354    # pcre
355    ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
356    SET(targets ${targets} pcre)
357  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
358    SET(targets ${targets} pcreposix)
359  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
360    IF(MINGW AND NOT PCRE_STATIC)
361  IF(MINGW AND NON_STANDARD_LIB_PREFIX AND NOT PCRE_STATIC)    IF(NON_STANDARD_LIB_PREFIX)
362  SET_TARGET_PROPERTIES(pcre pcreposix      SET_TARGET_PROPERTIES(pcre pcreposix
363                          PROPERTIES PREFIX ""                          PROPERTIES PREFIX ""
364  )      )
365  ENDIF(MINGW AND NON_STANDARD_LIB_PREFIX AND NOT PCRE_STATIC)    ENDIF(NON_STANDARD_LIB_PREFIX)
366    
367  IF(MINGW AND NON_STANDARD_LIB_SUFFIX AND NOT PCRE_STATIC)    IF(NON_STANDARD_LIB_SUFFIX)
368  SET_TARGET_PROPERTIES(pcre pcreposix      SET_TARGET_PROPERTIES(pcre pcreposix
369                          PROPERTIES SUFFIX "-0.dll"                          PROPERTIES SUFFIX "-0.dll"
370  )      )
371  ENDIF(MINGW AND NON_STANDARD_LIB_SUFFIX AND NOT PCRE_STATIC)    ENDIF(NON_STANDARD_LIB_SUFFIX)
372    ENDIF(MINGW AND NOT PCRE_STATIC)
373    
374    
375    # pcrecpp
376  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
377    ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})    ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
378    SET(targets ${targets} pcrecpp)
379    TARGET_LINK_LIBRARIES(pcrecpp pcre)    TARGET_LINK_LIBRARIES(pcrecpp pcre)
 IF(MINGW AND NON_STANDARD_LIB_PREFIX AND NOT PCRE_STATIC)  
 SET_TARGET_PROPERTIES(pcrecpp  
                         PROPERTIES PREFIX ""  
 )  
 ENDIF(MINGW AND NON_STANDARD_LIB_PREFIX AND NOT PCRE_STATIC)  
 IF(MINGW AND NON_STANDARD_LIB_SUFFIX AND NOT PCRE_STATIC)  
 SET_TARGET_PROPERTIES(pcrecpp  
                         PROPERTIES SUFFIX "-0.dll"  
 )  
 ENDIF(MINGW AND NON_STANDARD_LIB_SUFFIX AND NOT PCRE_STATIC)  
380    
381      IF(MINGW AND NOT PCRE_STATIC)
382        IF(NON_STANDARD_LIB_PREFIX)
383          SET_TARGET_PROPERTIES(pcrecpp
384                                PROPERTIES PREFIX ""
385          )
386        ENDIF(NON_STANDARD_LIB_PREFIX)
387    
388        IF(NON_STANDARD_LIB_SUFFIX)
389          SET_TARGET_PROPERTIES(pcrecpp
390                              PROPERTIES SUFFIX "-0.dll"
391          )
392        ENDIF(NON_STANDARD_LIB_SUFFIX)
393      ENDIF(MINGW AND NOT PCRE_STATIC)
394  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
395    
 # Executables  
   
 ADD_EXECUTABLE(pcretest pcretest.c)  
 TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})  
   
 ADD_EXECUTABLE(pcregrep pcregrep.c)  
 TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})  
   
 ADD_EXECUTABLE(pcredemo pcredemo.c)  
 TARGET_LINK_LIBRARIES(pcredemo pcreposix)  
 IF(NOT BUILD_SHARED_LIBS)  
     # make sure to not use declspec(dllimport) in static mode on windows  
         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")  
 ENDIF(NOT BUILD_SHARED_LIBS)  
   
 IF(PCRE_BUILD_PCRECPP)  
         ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)  
         TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)  
 IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)  
 SET_TARGET_PROPERTIES(pcrecpp  
                         PROPERTIES PREFIX ""  
 )  
 ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)  
396    
397    # Executables
398    
399          ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)  # Removed by PH (2008-01-23) because pcredemo shouldn't really be built
400          TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)  # automatically, and it gave trouble in some environments anyway.
401    # ADD_EXECUTABLE(pcredemo pcredemo.c)
402    # TARGET_LINK_LIBRARIES(pcredemo pcreposix)
403    # IF(NOT BUILD_SHARED_LIBS)
404    #     # make sure to not use declspec(dllimport) in static mode on windows
405    #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
406    # ENDIF(NOT BUILD_SHARED_LIBS)
407    
408    IF(PCRE_BUILD_PCREGREP)
409      ADD_EXECUTABLE(pcregrep pcregrep.c)
410      SET(targets ${targets} pcregrep)
411      TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
412    ENDIF(PCRE_BUILD_PCREGREP)
413    
         ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)  
         TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)  
 ENDIF(PCRE_BUILD_PCRECPP)  
414    
415  # Testing  # Testing
416    IF(PCRE_BUILD_TESTS)
417      ENABLE_TESTING()
418    
419  ENABLE_TESTING()    ADD_EXECUTABLE(pcretest pcretest.c)
420      SET(targets ${targets} pcretest)
421      TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
422    
423      IF(PCRE_BUILD_PCRECPP)
424        ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
425        SET(targets ${targets} pcrecpp_unittest)
426        TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
427        IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
428          SET_TARGET_PROPERTIES(pcrecpp
429                            PROPERTIES PREFIX ""
430          )
431        ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
432    
 GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)  
 GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)  
433    
434  # Write out a CTest configuration file that sets some needed environment      ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
435  # variables for the test scripts.      SET(targets ${targets} pcre_scanner_unittest)
436  #      TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
437  FILE(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.ctest  
438  "# This is a generated file.      ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
439  SET(ENV{srcdir} ${CMAKE_SOURCE_DIR})      SET(targets ${targets} pcre_stringpiece_unittest)
440  SET(ENV{pcregrep} ${PCREGREP_EXE})      TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
441  SET(ENV{pcretest} ${PCRETEST_EXE})    ENDIF(PCRE_BUILD_PCRECPP)
442  ")  
443      GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
444  IF(UNIX)    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
445          ADD_TEST(pcre_test      ${CMAKE_SOURCE_DIR}/RunTest)  
446          ADD_TEST(pcre_grep_test ${CMAKE_SOURCE_DIR}/RunGrepTest)    # Write out a CTest configuration file that sets some needed environment
447  ENDIF(UNIX)    # variables for the test scripts.
448  IF(WIN32)    #
449          ADD_TEST(pcre_test cmd /C ${CMAKE_SOURCE_DIR}/RunTest.bat)    FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
450  ENDIF(WIN32)    "# This is a generated file.
451      SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})
452  GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE    SET(ENV{pcregrep} ${PCREGREP_EXE})
453                      pcrecpp_unittest    SET(ENV{pcretest} ${PCRETEST_EXE})
454                      DEBUG_LOCATION)    ")
455    
456  GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE    IF(UNIX)
457                      pcre_scanner_unittest            ADD_TEST(pcre_test      ${PROJECT_SOURCE_DIR}/RunTest)
458                      DEBUG_LOCATION)            ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest)
459      ENDIF(UNIX)
460  GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE    IF(WIN32)
461                      pcre_stringpiece_unittest            ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)
462                      DEBUG_LOCATION)    ENDIF(WIN32)
463    
464  ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})    GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
465  ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})                        pcrecpp_unittest
466  ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})                        DEBUG_LOCATION)
467    
468      GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
469                          pcre_scanner_unittest
470                          DEBUG_LOCATION)
471    
472      GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
473                          pcre_stringpiece_unittest
474                          DEBUG_LOCATION)
475    
476      ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})
477      ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})
478      ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})
479    ENDIF(PCRE_BUILD_TESTS)
480    
481  # Installation  # Installation
   
482  SET(CMAKE_INSTALL_ALWAYS 1)  SET(CMAKE_INSTALL_ALWAYS 1)
483    
484  INSTALL(TARGETS pcre pcreposix pcregrep pcretest  INSTALL(TARGETS ${targets}
485          RUNTIME DESTINATION bin          RUNTIME DESTINATION bin
486          LIBRARY DESTINATION lib          LIBRARY DESTINATION lib
487          ARCHIVE DESTINATION lib)          ARCHIVE DESTINATION lib)
488    
489  INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)  INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
490    
491  FILE(GLOB html ${CMAKE_SOURCE_DIR}/doc/html/*.html)  FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
492  FILE(GLOB man1 ${CMAKE_SOURCE_DIR}/doc/*.1)  FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
493  FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)  FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
494    
495  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
496          INSTALL(TARGETS pcrecpp          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
                 RUNTIME DESTINATION bin  
                 LIBRARY DESTINATION lib  
                 ARCHIVE DESTINATION lib)  
         INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)  
497  ELSE(PCRE_BUILD_PCRECPP)  ELSE(PCRE_BUILD_PCRECPP)
498          # Remove pcrecpp.3          # Remove pcrecpp.3
499          FOREACH(man ${man3})          FOREACH(man ${man3})
500                  GET_FILENAME_COMPONENT(man_tmp ${man} NAME)                  GET_FILENAME_COMPONENT(man_tmp ${man} NAME)
501                  IF(NOT man_tmp STREQUAL "pcrecpp.3")                  IF(NOT man_tmp STREQUAL "pcrecpp.3")
502                          SET(man3_new ${man3} ${man})                          SET(man3_new ${man3} ${man})
503                  ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")                  ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")
504          ENDFOREACH(man ${man3})          ENDFOREACH(man ${man3})
505          SET(man3 ${man3_new})          SET(man3 ${man3_new})
506  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
507    
508    
# Line 470  ELSE(BUILD_SHARED_LIBS) Line 517  ELSE(BUILD_SHARED_LIBS)
517    SET(BUILD_STATIC_LIBS ON)    SET(BUILD_STATIC_LIBS ON)
518  ENDIF(BUILD_SHARED_LIBS)  ENDIF(BUILD_SHARED_LIBS)
519    
520  MESSAGE(STATUS "")  IF(PCRE_SHOW_REPORT)
521  MESSAGE(STATUS "")    MESSAGE(STATUS "")
522  MESSAGE(STATUS "PCRE configuration summary:")    MESSAGE(STATUS "")
523  MESSAGE(STATUS "")    MESSAGE(STATUS "PCRE configuration summary:")
524  MESSAGE(STATUS "  Install prefix .................. : " ${CMAKE_INSTALL_PREFIX})    MESSAGE(STATUS "")
525  MESSAGE(STATUS "  C compiler ...................... : " ${CMAKE_C_COMPILER})    MESSAGE(STATUS "  Install prefix .................. : " ${CMAKE_INSTALL_PREFIX})
526  MESSAGE(STATUS "  C++ compiler .................... : " ${CMAKE_CXX_COMPILER})    MESSAGE(STATUS "  C compiler ...................... : " ${CMAKE_C_COMPILER})
527  MESSAGE(STATUS "  C compiler flags ................ : " ${CMAKE_C_FLAGS})   #FIXME    MESSAGE(STATUS "  C++ compiler .................... : " ${CMAKE_CXX_COMPILER})
528  MESSAGE(STATUS "  C++ compiler flags .............. : " ${CMAKE_CXX_FLAGS}) #FIXME    MESSAGE(STATUS "  C compiler flags ................ : " ${CMAKE_C_FLAGS})   #FIXME
529  MESSAGE(STATUS "")    MESSAGE(STATUS "  C++ compiler flags .............. : " ${CMAKE_CXX_FLAGS}) #FIXME
530  MESSAGE(STATUS "  Build C++ library ............... : " ${PCRE_BUILD_PCRECPP})    MESSAGE(STATUS "")
531  MESSAGE(STATUS "  Enable UTF-8 support ............ : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})    MESSAGE(STATUS "  Build C++ library ............... : " ${PCRE_BUILD_PCRECPP})
532  MESSAGE(STATUS "  Unicode properties .............. : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})    MESSAGE(STATUS "  Enable UTF-8 support ............ : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})
533  MESSAGE(STATUS "  Newline char/sequence ........... : " ${PCRE_NEWLINE})    MESSAGE(STATUS "  Unicode properties .............. : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})
534  MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : " ${PCRE_SUPPORT_BSR_ANYCRLF})    MESSAGE(STATUS "  Newline char/sequence ........... : " ${PCRE_NEWLINE})
535  MESSAGE(STATUS "  EBCDIC coding ................... : " ${PCRE_EBCDIC})    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : " ${PCRE_SUPPORT_BSR_ANYCRLF})
536  MESSAGE(STATUS "  Rebuild char tables ............. : " ${PCRE_REBUILD_CHARTABLES})    MESSAGE(STATUS "  EBCDIC coding ................... : " ${PCRE_EBCDIC})
537  MESSAGE(STATUS "  No stack recursion .............. : " ${PCRE_NO_RECURSE})    MESSAGE(STATUS "  Rebuild char tables ............. : " ${PCRE_REBUILD_CHARTABLES})
538  MESSAGE(STATUS "  POSIX mem threshold ............. : " ${PCRE_POSIX_MALLOC_THRESHOLD})    MESSAGE(STATUS "  No stack recursion .............. : " ${PCRE_NO_RECURSE})
539  MESSAGE(STATUS "  Internal link size .............. : " ${PCRE_LINK_SIZE})    MESSAGE(STATUS "  POSIX mem threshold ............. : " ${PCRE_POSIX_MALLOC_THRESHOLD})
540  MESSAGE(STATUS "  Match limit ..................... : " ${PCRE_MATCH_LIMIT})    MESSAGE(STATUS "  Internal link size .............. : " ${PCRE_LINK_SIZE})
541  MESSAGE(STATUS "  Match limit recursion ........... : " ${PCRE_MATCH_LIMIT_RECURSION})    MESSAGE(STATUS "  Match limit ..................... : " ${PCRE_MATCH_LIMIT})
542  MESSAGE(STATUS "  Build shared libs ............... : " ${BUILD_SHARED_LIBS})    MESSAGE(STATUS "  Match limit recursion ........... : " ${PCRE_MATCH_LIMIT_RECURSION})
543  MESSAGE(STATUS "  Build static libs ............... : " ${BUILD_STATIC_LIBS})    MESSAGE(STATUS "  Build shared libs ............... : " ${BUILD_SHARED_LIBS})
544  IF(ZLIB_FOUND)    MESSAGE(STATUS "  Build static libs ............... : " ${BUILD_STATIC_LIBS})
545    MESSAGE(STATUS "  Link pcregrep with libz ......... : " ${PCRE_SUPPORT_LIBZ})    MESSAGE(STATUS "  Build pcregrep .................. : " ${PCRE_BUILD_PCREGREP})
546  ELSE(ZLIB_FOUND)    MESSAGE(STATUS "  Build tests (implies pcretest) .. : " ${PCRE_BUILD_TESTS})
547    MESSAGE(STATUS "  Link pcregrep with libz ......... :   zlib libraries not found!" )    IF(ZLIB_FOUND)
548  ENDIF(ZLIB_FOUND)      MESSAGE(STATUS "  Link pcregrep with libz ......... : " ${PCRE_SUPPORT_LIBZ})
549  IF(BZIP2_FOUND)    ELSE(ZLIB_FOUND)
550    MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : " ${PCRE_SUPPORT_LIBBZ2})      MESSAGE(STATUS "  Link pcregrep with libz ......... : None" )
551  ELSE(BZIP2_FOUND)    ENDIF(ZLIB_FOUND)
552    MESSAGE(STATUS "  Link pcregrep with libbz2 ....... :   bzip2 libraries not found!" )    IF(BZIP2_FOUND)
553  ENDIF(BZIP2_FOUND)      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : " ${PCRE_SUPPORT_LIBBZ2})
554  MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})    ELSE(BZIP2_FOUND)
555  MESSAGE(STATUS "")      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )
556      ENDIF(BZIP2_FOUND)
557      IF(NOT PCRE_SUPPORT_LIBREADLINE)
558        MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )
559      ELSE(NOT PCRE_SUPPORT_LIBREADLINE)
560        MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})
561      ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
562      IF(MINGW AND NOT PCRE_STATIC)
563        MESSAGE(STATUS "  Non-standard dll names (prefix) . : " ${NON_STANDARD_LIB_PREFIX})
564        MESSAGE(STATUS "  Non-standard dll names (suffix) . : " ${NON_STANDARD_LIB_SUFFIX})
565      ENDIF(MINGW AND NOT PCRE_STATIC)
566      MESSAGE(STATUS "")
567    ENDIF(PCRE_SHOW_REPORT)
568    
569  # end CMakeLists.txt  # end CMakeLists.txt

Legend:
Removed from v.311  
changed lines
  Added in v.411

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12