diff options
Diffstat (limited to '3rdparty/pcre')
-rw-r--r-- | 3rdparty/pcre/CMakeLists.txt | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/3rdparty/pcre/CMakeLists.txt b/3rdparty/pcre/CMakeLists.txt index 0625999b1..ab1c83b6d 100644 --- a/3rdparty/pcre/CMakeLists.txt +++ b/3rdparty/pcre/CMakeLists.txt @@ -4,25 +4,25 @@ # if( WIN32 ) message( STATUS "Detecting local PCRE" ) -find_path( LOCAL_PCRE_INCLUDE_DIRS "pcre.h" +find_path( PCRE_LOCAL_INCLUDE_DIRS "pcre.h" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include" NO_DEFAULT_PATH ) -find_library( LOCAL_PCRE_LIBRARIES +find_library( PCRE_LOCAL_LIBRARIES NAMES pcre PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib" NO_DEFAULT_PATH ) -mark_as_advanced( LOCAL_PCRE_LIBRARIES ) -mark_as_advanced( LOCAL_PCRE_INCLUDE_DIRS ) +mark_as_advanced( PCRE_LOCAL_LIBRARIES ) +mark_as_advanced( PCRE_LOCAL_INCLUDE_DIRS ) -if( LOCAL_PCRE_LIBRARIES AND LOCAL_PCRE_INCLUDE_DIRS ) - file( STRINGS "${LOCAL_PCRE_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) +if( PCRE_LOCAL_LIBRARIES AND PCRE_LOCAL_INCLUDE_DIRS ) + file( STRINGS "${PCRE_LOCAL_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" ) string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" ) - message( STATUS "Found PCRE: ${LOCAL_PCRE_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" ) + message( STATUS "Found PCRE: ${PCRE_LOCAL_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" ) set( HAVE_LOCAL_PCRE ON CACHE BOOL "pcre is available as a local copy" ) else() - foreach( _VAR LOCAL_PCRE_LIBRARIES LOCAL_PCRE_INCLUDE_DIRS ) + foreach( _VAR PCRE_LOCAL_LIBRARIES PCRE_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) set( MISSING_VARS ${MISSING_VARS} ${_VAR} ) endif() @@ -39,15 +39,17 @@ endif( WIN32 ) # message( STATUS "Detecting system PCRE" ) set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) +unset( PCRE_LIBRARIES CACHE ) +unset( PCRE_INCLUDE_DIRS CACHE ) find_package( PCRE ) -set( SYSTEM_PCRE_LIBRARIES ${PCRE_LIBRARIES} +set( PCRE_SYSTEM_LIBRARIES ${PCRE_LIBRARIES} CACHE PATH "system pcre libraries" ) -set( SYSTEM_PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} +set( PCRE_SYSTEM_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} CACHE PATH "system pcre include directories" ) -mark_as_advanced( SYSTEM_PCRE_LIBRARIES ) -mark_as_advanced( SYSTEM_PCRE_INCLUDE_DIRS ) +mark_as_advanced( PCRE_SYSTEM_LIBRARIES ) +mark_as_advanced( PCRE_SYSTEM_INCLUDE_DIRS ) -if( SYSTEM_PCRE_LIBRARIES AND SYSTEM_PCRE_INCLUDE_DIRS ) +if( PCRE_SYSTEM_LIBRARIES AND PCRE_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_PCRE ON CACHE BOOL "pcre is available on the system" ) else() @@ -59,34 +61,4 @@ message( STATUS "Detecting system PCRE - done" ) # # configure # -unset( PCRE_LIBRARIES CACHE ) -unset( PCRE_INCLUDE_DIRS CACHE ) -if( HAVE_LOCAL_PCRE ) - set( USE_LOCAL_PCRE ON - CACHE BOOL "use local copy of pcre" ) -else() - unset( USE_LOCAL_PCRE CACHE ) -endif() -if( USE_LOCAL_PCRE ) - message( STATUS "Configuring for local PCRE" ) - set( PCRE_LIBRARIES ${LOCAL_PCRE_LIBRARIES} ) - set( PCRE_INCLUDE_DIRS ${LOCAL_PCRE_INCLUDE_DIRS} ) - message( STATUS "Configuring for local PCRE - done" ) -elseif( HAVE_SYSTEM_PCRE ) - message( STATUS "Configuring for system PCRE" ) - set( PCRE_LIBRARIES ${SYSTEM_PCRE_LIBRARIES} ) - set( PCRE_INCLUDE_DIRS ${SYSTEM_PCRE_INCLUDE_DIRS} ) - message( STATUS "Configuring for system PCRE - done" ) -endif() -if( USE_LOCAL_PCRE OR HAVE_SYSTEM_PCRE ) - set( USE_PCRE ON - CACHE BOOL "use pcre" ) -else() - unset( USE_PCRE CACHE ) -endif() -set( PCRE_LIBRARIES ${PCRE_LIBRARIES} - CACHE PATH "pcre libraries" ) -set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} - CACHE PATH "pcre include directories" ) -mark_as_advanced( PCRE_LIBRARIES ) -mark_as_advanced( PCRE_INCLUDE_DIRS ) +CONFIGURE_USE_LOCAL_OR_SYSTEM( PCRE ) |