/[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 292 by ph10, Thu Dec 27 09:27:23 2007 UTC revision 303 by ph10, Sun Jan 20 19:39:43 2008 UTC
# Line 13  Line 13 
13  #                not a previously-installed one.  #                not a previously-installed one.
14  #            (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and  #            (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and
15  #                PCRE_SUPPORT_LIBBZ2.  #                PCRE_SUPPORT_LIBBZ2.
16    # 2008-01-20 Brought up to date to include several new features by Christian
17    #            Ehrlicher.
18  #  #
19    
20  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
21    
22  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)
23    
24    SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # for FindReadline.cmake
25    
26    # external packages
27    FIND_PACKAGE( BZip2 )
28    FIND_PACKAGE( ZLIB )
29    FIND_PACKAGE( Readline )
30    
31  # Configuration checks  # Configuration checks
32    
33  INCLUDE(CheckIncludeFile)  INCLUDE(CheckIncludeFile)
# Line 26  INCLUDE(CheckIncludeFileCXX) Line 35  INCLUDE(CheckIncludeFileCXX)
35  INCLUDE(CheckFunctionExists)  INCLUDE(CheckFunctionExists)
36  INCLUDE(CheckTypeSize)  INCLUDE(CheckTypeSize)
37    
38  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)  CHECK_INCLUDE_FILE(dirent.h         HAVE_DIRENT_H)
 CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)  
39  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
40  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
41    CHECK_INCLUDE_FILE(unistd.h         HAVE_UNISTD_H)
42  CHECK_INCLUDE_FILE(bzlib.h      HAVE_BZLIB_H)  CHECK_INCLUDE_FILE(windows.h    HAVE_WINDOWS_H)
 CHECK_INCLUDE_FILE(zlib.h       HAVE_ZLIB_H)  
 CHECK_INCLUDE_FILE(readline/history.h  HAVE_READLINE_HISTORY_H)  
 CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_READLINE_H)  
43    
44  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)  CHECK_INCLUDE_FILE_CXX(type_traits.h            HAVE_TYPE_TRAITS_H)
45  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)
# Line 42  CHECK_INCLUDE_FILE_CXX(bits/type_traits. Line 47  CHECK_INCLUDE_FILE_CXX(bits/type_traits.
47  CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)  CHECK_FUNCTION_EXISTS(bcopy     HAVE_BCOPY)
48  CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)  CHECK_FUNCTION_EXISTS(memmove   HAVE_MEMMOVE)
49  CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)  CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)
50    CHECK_FUNCTION_EXISTS(strtoll   HAVE_STRTOLL)
51    CHECK_FUNCTION_EXISTS(strtoq    HAVE_STRTOQ)
52    CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
53    
54  CHECK_TYPE_SIZE("long long"             LONG_LONG)  CHECK_TYPE_SIZE("long long"             LONG_LONG)
55  CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)  CHECK_TYPE_SIZE("unsigned long long"    UNSIGNED_LONG_LONG)
# Line 86  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL Line 94  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
94  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
95      "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")
96    
97  SET(PCRE_SUPPORT_LIBBZ2 OFF CACHE BOOL  # bzip2 lib
98      "Enable support for linking pcregrep with libbz2.")  IF(BZIP2_FOUND)
99      OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON)
100    ENDIF(BZIP2_FOUND)
101    IF(PCRE_SUPPORT_LIBBZ2)
102      INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
103    ENDIF(PCRE_SUPPORT_LIBBZ2)
104    
105  SET (PCRE_SUPPORT_LIBZ OFF CACHE BOOL  # zlib
106      "Enable support for linking pcregrep with libz.")  IF(ZLIB_FOUND)
107      OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON)
108    ENDIF(ZLIB_FOUND)
109    IF(PCRE_SUPPORT_LIBZ)
110      INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
111    ENDIF(PCRE_SUPPORT_LIBZ)
112    
113  SET (PCRE_SUPPORT_LIBREADLINE OFF CACHE BOOL  # readline lib
114      "Enable support for linking pcretest with libreadline.")  IF(READLINE_FOUND)
115      OPTION (PCRE_SUPPORT_LIBREADLINE  "Enable support for linking pcretest with libreadline." ON)
116    ENDIF(READLINE_FOUND)
117    IF(PCRE_SUPPORT_LIBREADLINE)
118      INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
119    ENDIF(PCRE_SUPPORT_LIBREADLINE)
120    
121  # Prepare build configuration  # Prepare build configuration
122    
# Line 137  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) Line 160  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
160    
161  IF(PCRE_SUPPORT_LIBREADLINE)  IF(PCRE_SUPPORT_LIBREADLINE)
162          SET(SUPPORT_LIBREADLINE 1)          SET(SUPPORT_LIBREADLINE 1)
163          SET(PCRETEST_LIBS readline)          SET(PCRETEST_LIBS ${READLINE_LIBRARY})
164  ENDIF(PCRE_SUPPORT_LIBREADLINE)  ENDIF(PCRE_SUPPORT_LIBREADLINE)
165    
166  IF(PCRE_SUPPORT_LIBZ)  IF(PCRE_SUPPORT_LIBZ)
167          SET(SUPPORT_LIBZ 1)          SET(SUPPORT_LIBZ 1)
168          SET(PCREGREP_LIBS z)          SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
169  ENDIF(PCRE_SUPPORT_LIBZ)  ENDIF(PCRE_SUPPORT_LIBZ)
170    
171  IF(PCRE_SUPPORT_LIBBZ2)  IF(PCRE_SUPPORT_LIBBZ2)
172          SET(SUPPORT_LIBBZ2 1)          SET(SUPPORT_LIBBZ2 1)
173          SET(PCREGREP_LIBS ${PCREGREP_LIBS} bz2)          SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
174  ENDIF(PCRE_SUPPORT_LIBBZ2)  ENDIF(PCRE_SUPPORT_LIBBZ2)
175    
176  SET(NEWLINE "")  SET(NEWLINE "")
# Line 204  ENDIF(PCRE_BUILD_PCRECPP) Line 227  ENDIF(PCRE_BUILD_PCRECPP)
227    
228  # Character table generation  # Character table generation
229    
230  ADD_EXECUTABLE(dftables dftables.c)  OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
231    IF(PCRE_REBUILD_CHARTABLES)
232  GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)    ADD_EXECUTABLE(dftables dftables.c)
233    
234  ADD_CUSTOM_COMMAND(    GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
235          COMMENT "Generating character tables (pcre_chartables.c) for current locale"  
236          DEPENDS dftables    ADD_CUSTOM_COMMAND(
237          COMMAND ${DFTABLES_EXE}      COMMENT "Generating character tables (pcre_chartables.c) for current locale"
238          ARGS    ${CMAKE_BINARY_DIR}/pcre_chartables.c      DEPENDS dftables
239          OUTPUT  ${CMAKE_BINARY_DIR}/pcre_chartables.c      COMMAND ${DFTABLES_EXE}
240  )      ARGS        ${CMAKE_BINARY_DIR}/pcre_chartables.c
241        OUTPUT      ${CMAKE_BINARY_DIR}/pcre_chartables.c
242      )
243    ELSE(PCRE_REBUILD_CHARTABLES)
244      CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pcre_chartables.c.dist
245                        ${CMAKE_BINARY_DIR}/pcre_chartables.c
246                        COPYONLY)
247    ENDIF(PCRE_REBUILD_CHARTABLES)
248    
249  # Source code  # Source code
250    
251  SET(PCRE_HEADERS ${CMAKE_BINARY_DIR}/pcre.h)  SET(PCRE_HEADERS ${CMAKE_BINARY_DIR}/pcre.h)
252    
253  SET(PCRE_SOURCES  SET(PCRE_SOURCES
254          ${CMAKE_BINARY_DIR}/pcre_chartables.c    ${CMAKE_BINARY_DIR}/pcre_chartables.c
255          pcre_compile.c    pcre_compile.c
256          pcre_config.c    pcre_config.c
257          pcre_dfa_exec.c    pcre_dfa_exec.c
258          pcre_exec.c    pcre_exec.c
259          pcre_fullinfo.c    pcre_fullinfo.c
260          pcre_get.c    pcre_get.c
261          pcre_globals.c    pcre_globals.c
262          pcre_info.c    pcre_info.c
263          pcre_newline.c    pcre_newline.c
264          pcre_maketables.c    pcre_maketables.c
265          pcre_ord2utf8.c    pcre_ord2utf8.c
266          pcre_refcount.c    pcre_refcount.c
267          pcre_study.c    pcre_study.c
268          pcre_tables.c    pcre_tables.c
269          pcre_try_flipped.c    pcre_try_flipped.c
270          pcre_ucp_searchfuncs.c    pcre_ucp_searchfuncs.c
271          pcre_valid_utf8.c    pcre_valid_utf8.c
272          pcre_version.c    pcre_version.c
273          pcre_xclass.c    pcre_xclass.c
274  )  )
275    
276  SET(PCREPOSIX_HEADERS pcreposix.h)  SET(PCREPOSIX_HEADERS pcreposix.h)
# Line 248  SET(PCREPOSIX_HEADERS pcreposix.h) Line 278  SET(PCREPOSIX_HEADERS pcreposix.h)
278  SET(PCREPOSIX_SOURCES pcreposix.c)  SET(PCREPOSIX_SOURCES pcreposix.c)
279    
280  SET(PCRECPP_HEADERS  SET(PCRECPP_HEADERS
281          pcrecpp.h    pcrecpp.h
282          pcre_scanner.h    pcre_scanner.h
283          ${CMAKE_BINARY_DIR}/pcrecpparg.h    ${CMAKE_BINARY_DIR}/pcrecpparg.h
284          ${CMAKE_BINARY_DIR}/pcre_stringpiece.h    ${CMAKE_BINARY_DIR}/pcre_stringpiece.h
285  )  )
286    
287  SET(PCRECPP_SOURCES  SET(PCRECPP_SOURCES
# Line 264  SET(PCRECPP_SOURCES Line 294  SET(PCRECPP_SOURCES
294    
295  ADD_DEFINITIONS(-DHAVE_CONFIG_H)  ADD_DEFINITIONS(-DHAVE_CONFIG_H)
296    
297  IF(WIN32)  IF(MSVC)
298          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)          ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
299  ENDIF(WIN32)  ENDIF(MSVC)
300    
301  SET(CMAKE_INCLUDE_CURRENT_DIR 1)  SET(CMAKE_INCLUDE_CURRENT_DIR 1)
302    # needed to make sure to not link debug libs
303  #SET(CMAKE_DEBUG_POSTFIX "d")  # against release libs and vice versa
304    IF(WIN32)
305      SET(CMAKE_DEBUG_POSTFIX "d")
306    ENDIF(WIN32)
307    
308  # Libraries  # Libraries
309    
310  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES})  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${CMAKE_BINARY_DIR}/config.h)
   
311  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
312  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
313    
 IF(NOT UNIX)  
 SET_TARGET_PROPERTIES(pcre pcreposix  
                         PROPERTIES PREFIX ""  
 )  
 ENDIF(NOT UNIX)  
   
314  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
315          ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})    ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
316          TARGET_LINK_LIBRARIES(pcrecpp pcre)    TARGET_LINK_LIBRARIES(pcrecpp pcre)
         IF(MINGW)  
                 SET_TARGET_PROPERTIES(pcrecpp PROPERTIES PREFIX "mingw-")  
         ENDIF(MINGW)  
317  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
318    
319  # Executables  # Executables
# Line 301  TARGET_LINK_LIBRARIES(pcretest pcreposix Line 324  TARGET_LINK_LIBRARIES(pcretest pcreposix
324  ADD_EXECUTABLE(pcregrep pcregrep.c)  ADD_EXECUTABLE(pcregrep pcregrep.c)
325  TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})  TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
326    
327    ADD_EXECUTABLE(pcredemo pcredemo.c)
328    TARGET_LINK_LIBRARIES(pcredemo pcreposix)
329    IF(NOT BUILD_SHARED_LIBS)
330        # make sure to not use declspec(dllimport) in static mode on windows
331            SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
332    ENDIF(NOT BUILD_SHARED_LIBS)
333    
334  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
335          ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)          ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
336          TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)          TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
# Line 389  INSTALL(FILES ${man1} DESTINATION man/ma Line 419  INSTALL(FILES ${man1} DESTINATION man/ma
419  INSTALL(FILES ${man3} DESTINATION man/man3)  INSTALL(FILES ${man3} DESTINATION man/man3)
420  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
421    
422    # help, only for nice output
423    IF(BUILD_SHARED_LIBS)
424      SET(BUILD_STATIC_LIBS OFF)
425    ELSE(BUILD_SHARED_LIBS)
426      SET(BUILD_STATIC_LIBS ON)
427    ENDIF(BUILD_SHARED_LIBS)
428    
429    MESSAGE(STATUS "")
430    MESSAGE(STATUS "")
431    MESSAGE(STATUS "PCRE configuration summary:")
432    MESSAGE(STATUS "")
433    MESSAGE(STATUS "  Install prefix .................. : " ${CMAKE_INSTALL_PREFIX})
434    MESSAGE(STATUS "  C compiler ...................... : " ${CMAKE_C_COMPILER})
435    MESSAGE(STATUS "  C++ compiler .................... : " ${CMAKE_CXX_COMPILER})
436    MESSAGE(STATUS "  C compiler flags ................ : " ${CMAKE_C_FLAGS})   #FIXME
437    MESSAGE(STATUS "  C++ compiler flags .............. : " ${CMAKE_CXX_FLAGS}) #FIXME
438    MESSAGE(STATUS "")
439    MESSAGE(STATUS "  Build C++ library ............... : " ${PCRE_BUILD_PCRECPP})
440    MESSAGE(STATUS "  Enable UTF-8 support ............ : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})
441    MESSAGE(STATUS "  Unicode properties .............. : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})
442    MESSAGE(STATUS "  Newline char/sequence ........... : " ${PCRE_NEWLINE})
443    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : " ${PCRE_SUPPORT_BSR_ANYCRLF})
444    MESSAGE(STATUS "  EBCDIC coding ................... : " ${PCRE_EBCDIC})
445    MESSAGE(STATUS "  Rebuild char tables ............. : " ${PCRE_REBUILD_CHARTABLES})
446    MESSAGE(STATUS "  Use stack recursion ............. : " ${PCRE_NO_RECURSE})
447    MESSAGE(STATUS "  POSIX mem threshold ............. : " ${PCRE_POSIX_MALLOC_THRESHOLD})
448    MESSAGE(STATUS "  Internal link size .............. : " ${PCRE_LINK_SIZE})
449    MESSAGE(STATUS "  Match limit ..................... : " ${PCRE_MATCH_LIMIT})
450    MESSAGE(STATUS "  Match limit recursion ........... : " ${PCRE_MATCH_LIMIT_RECURSION})
451    MESSAGE(STATUS "  Build shared libs ............... : " ${BUILD_SHARED_LIBS})
452    MESSAGE(STATUS "  Build static libs ............... : " ${BUILD_STATIC_LIBS})
453    IF(ZLIB_FOUND)
454      MESSAGE(STATUS "  Link pcregrep with libz ......... : " ${PCRE_SUPPORT_LIBZ})
455    ELSE(ZLIB_FOUND)
456      MESSAGE(STATUS "  Link pcregrep with libz ......... :   zlib libraries not found!" )
457    ENDIF(ZLIB_FOUND)
458    IF(BZIP2_FOUND)
459      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : " ${PCRE_SUPPORT_LIBBZ2})
460    ELSE(BZIP2_FOUND)
461      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... :   bzip2 libraries not found!" )
462    ENDIF(BZIP2_FOUND)
463    MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})
464    MESSAGE(STATUS "")
465    
466  # end CMakeLists.txt  # end CMakeLists.txt

Legend:
Removed from v.292  
changed lines
  Added in v.303

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12