/[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 405 by ph10, Mon Mar 23 12:05:20 2009 UTC revision 407 by ph10, Mon Mar 23 15:29:18 2009 UTC
# Line 27  Line 27 
27  # 2008-01-23 PH removed the automatic build of pcredemo.  # 2008-01-23 PH removed the automatic build of pcredemo.
28  # 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.  # 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)  # 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  # 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  #            CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
32  #            is included within another project.  #            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    
# Line 108  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    OPTION(PCRE_SHOW_REPORT    "Show the final configuration report" ON)
115    OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
116    OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)
117    
118    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)  IF (MINGW)
126    OPTION(NON_STANDARD_LIB_PREFIX    OPTION(NON_STANDARD_LIB_PREFIX
# Line 335  IF(WIN32) Line 348  IF(WIN32)
348    SET(CMAKE_DEBUG_POSTFIX "d")    SET(CMAKE_DEBUG_POSTFIX "d")
349  ENDIF(WIN32)  ENDIF(WIN32)
350    
351    SET(targets)
352    
353  # Libraries  # Libraries
354  # pcre  # pcre
355  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)  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)  IF(MINGW AND NOT PCRE_STATIC)
361    IF(NON_STANDARD_LIB_PREFIX)    IF(NON_STANDARD_LIB_PREFIX)
# Line 358  ENDIF(MINGW AND NOT PCRE_STATIC) Line 375  ENDIF(MINGW AND NOT PCRE_STATIC)
375  # pcrecpp  # 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)
380    
381    IF(MINGW AND NOT PCRE_STATIC)    IF(MINGW AND NOT PCRE_STATIC)
# Line 378  ENDIF(PCRE_BUILD_PCRECPP) Line 396  ENDIF(PCRE_BUILD_PCRECPP)
396    
397  # Executables  # Executables
398    
 ADD_EXECUTABLE(pcretest pcretest.c)  
 TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})  
   
 ADD_EXECUTABLE(pcregrep pcregrep.c)  
 TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})  
   
399  # Removed by PH (2008-01-23) because pcredemo shouldn't really be built  # Removed by PH (2008-01-23) because pcredemo shouldn't really be built
400  # automatically, and it gave trouble in some environments anyway.  # automatically, and it gave trouble in some environments anyway.
401  # ADD_EXECUTABLE(pcredemo pcredemo.c)  # ADD_EXECUTABLE(pcredemo pcredemo.c)
# Line 393  TARGET_LINK_LIBRARIES(pcregrep pcreposix Line 405  TARGET_LINK_LIBRARIES(pcregrep pcreposix
405  #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")  #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
406  # ENDIF(NOT BUILD_SHARED_LIBS)  # ENDIF(NOT BUILD_SHARED_LIBS)
407    
408  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCREGREP)
409          ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)    ADD_EXECUTABLE(pcregrep pcregrep.c)
410          TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)    SET(targets ${targets} pcregrep)
411  IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)    TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
412  SET_TARGET_PROPERTIES(pcrecpp  ENDIF(PCRE_BUILD_PCREGREP)
                         PROPERTIES PREFIX ""  
 )  
 ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)  
   
413    
         ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)  
         TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)  
   
         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 ${PROJECT_BINARY_DIR}/CTestCustom.ctest  
438  "# This is a generated file.      ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
439  SET(ENV{srcdir} ${PROJECT_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      ${PROJECT_SOURCE_DIR}/RunTest)  
446          ADD_TEST(pcre_grep_test ${PROJECT_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 ${PROJECT_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)
# Line 467  FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc Line 493  FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc
493  FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)  FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
494    
495  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
         INSTALL(TARGETS pcrecpp  
                 RUNTIME DESTINATION bin  
                 LIBRARY DESTINATION lib  
                 ARCHIVE DESTINATION lib)  
496          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
497  ELSE(PCRE_BUILD_PCRECPP)  ELSE(PCRE_BUILD_PCRECPP)
498          # Remove pcrecpp.3          # Remove pcrecpp.3
# Line 495  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 ......... : None" )    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 ....... : None" )    IF(BZIP2_FOUND)
553  ENDIF(BZIP2_FOUND)      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : " ${PCRE_SUPPORT_LIBBZ2})
554  IF(NOT PCRE_SUPPORT_LIBREADLINE)    ELSE(BZIP2_FOUND)
555    MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )
556  ELSE(NOT PCRE_SUPPORT_LIBREADLINE)    ENDIF(BZIP2_FOUND)
557    MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})    IF(NOT PCRE_SUPPORT_LIBREADLINE)
558  ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)      MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )
559  IF(MINGW AND NOT PCRE_STATIC)    ELSE(NOT PCRE_SUPPORT_LIBREADLINE)
560    MESSAGE(STATUS "  Non-standard dll names (prefix) . : " ${NON_STANDARD_LIB_PREFIX})      MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})
561    MESSAGE(STATUS "  Non-standard dll names (suffix) . : " ${NON_STANDARD_LIB_SUFFIX})    ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
562  ENDIF(MINGW AND NOT PCRE_STATIC)    IF(MINGW AND NOT PCRE_STATIC)
563  MESSAGE(STATUS "")      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.405  
changed lines
  Added in v.407

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12