Commit b2ebe1cb authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Daniel Black

MDEV-33091 pcre2 headers aren't found on Solaris

use pkg-config to find pcre2, if possible

rename PCRE_INCLUDES to use PKG_CHECK_MODULES naming, PCRE_INCLUDE_DIRS
parent 2e23c734
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/mysys_ssl ${CMAKE_SOURCE_DIR}/mysys_ssl
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
......
INCLUDE (CheckCSourceRuns)
INCLUDE (ExternalProject) INCLUDE (ExternalProject)
SET(WITH_PCRE "auto" CACHE STRING SET(WITH_PCRE "auto" CACHE STRING
...@@ -6,7 +5,8 @@ SET(WITH_PCRE "auto" CACHE STRING ...@@ -6,7 +5,8 @@ SET(WITH_PCRE "auto" CACHE STRING
MACRO(BUNDLE_PCRE2) MACRO(BUNDLE_PCRE2)
SET(dir "${CMAKE_BINARY_DIR}/extra/pcre2") SET(dir "${CMAKE_BINARY_DIR}/extra/pcre2")
SET(PCRE_INCLUDES ${dir}/src/pcre2-build ${dir}/src/pcre2/src) SET(PCRE_INCLUDE_DIRS ${dir}/src/pcre2-build ${dir}/src/pcre2/src)
MESSAGE(STATUS "Will download and bundle pcre2")
SET(byproducts) SET(byproducts)
FOREACH(lib pcre2-posix pcre2-8) FOREACH(lib pcre2-posix pcre2-8)
ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL) ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL)
...@@ -76,10 +76,17 @@ SET_TARGET_PROPERTIES(pcre2 PROPERTIES EXCLUDE_FROM_ALL TRUE) ...@@ -76,10 +76,17 @@ SET_TARGET_PROPERTIES(pcre2 PROPERTIES EXCLUDE_FROM_ALL TRUE)
ENDMACRO() ENDMACRO()
MACRO (CHECK_PCRE) MACRO (CHECK_PCRE)
IF (NOT TARGET pcre2 AND NOT PCRE_FOUND)
IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto") IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto")
CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" HAVE_PCRE2) FIND_PACKAGE(PkgConfig QUIET)
PKG_CHECK_MODULES(PCRE libpcre2-8)
# in case pkg-config or libpcre2-8.pc is not installed:
IF(NOT PCRE_FOUND)
UNSET(PCRE_FOUND CACHE)
CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" PCRE_FOUND)
ENDIF() ENDIF()
IF(NOT HAVE_PCRE2 OR WITH_PCRE STREQUAL "bundled") ENDIF()
IF(NOT PCRE_FOUND OR WITH_PCRE STREQUAL "bundled")
IF (WITH_PCRE STREQUAL "system") IF (WITH_PCRE STREQUAL "system")
MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable") MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable")
ENDIF() ENDIF()
...@@ -90,5 +97,6 @@ MACRO (CHECK_PCRE) ...@@ -90,5 +97,6 @@ MACRO (CHECK_PCRE)
SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree") SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree")
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF()
ENDMACRO() ENDMACRO()
...@@ -44,7 +44,7 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -44,7 +44,7 @@ MACRO(MYSQL_ADD_PLUGIN)
# Add common include directories # Add common include directories
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}) ${ZLIB_INCLUDE_DIRS})
......
...@@ -36,7 +36,7 @@ INCLUDE_DIRECTORIES( ...@@ -36,7 +36,7 @@ INCLUDE_DIRECTORIES(
) )
IF(NOT HAVE_SYSTEM_REGEX) IF(NOT HAVE_SYSTEM_REGEX)
INCLUDE_DIRECTORIES(${PCRE_INCLUDES}) INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIRS})
ADD_DEFINITIONS(${PCRE2_DEBIAN_HACK}) ADD_DEFINITIONS(${PCRE2_DEBIAN_HACK})
ENDIF() ENDIF()
......
...@@ -23,7 +23,7 @@ ${CMAKE_SOURCE_DIR}/libmysqld ...@@ -23,7 +23,7 @@ ${CMAKE_SOURCE_DIR}/libmysqld
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/tpool ${CMAKE_SOURCE_DIR}/tpool
${CMAKE_BINARY_DIR}/sql ${CMAKE_BINARY_DIR}/sql
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
${SSL_INTERNAL_INCLUDE_DIRS} ${SSL_INTERNAL_INCLUDE_DIRS}
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld/include ${CMAKE_SOURCE_DIR}/libmysqld/include
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${MY_READLINE_INCLUDE_DIR} ${MY_READLINE_INCLUDE_DIR}
) )
......
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS}) ${SSL_INCLUDE_DIRS})
SET(FEEDBACK_SOURCES feedback.cc sender_thread.cc SET(FEEDBACK_SOURCES feedback.cc sender_thread.cc
......
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
${PCRE_INCLUDES}) ${PCRE_INCLUDE_DIRS})
MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc RECOMPILE_FOR_EMBEDDED) MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc RECOMPILE_FOR_EMBEDDED)
...@@ -52,7 +52,7 @@ ENDIF() ...@@ -52,7 +52,7 @@ ENDIF()
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/sql ${CMAKE_BINARY_DIR}/sql
......
...@@ -24,7 +24,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ...@@ -24,7 +24,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${CMAKE_BINARY_DIR}/sql ${CMAKE_BINARY_DIR}/sql
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS}) ${SSL_INCLUDE_DIRS})
ADD_DEFINITIONS(-DMYSQL_SERVER) ADD_DEFINITIONS(-DMYSQL_SERVER)
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mysql ${CMAKE_SOURCE_DIR}/include/mysql
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${SSL_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/unittest/mytap ${CMAKE_SOURCE_DIR}/unittest/mytap
......
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysqld/include ${CMAKE_SOURCE_DIR}/libmysqld/include
${PCRE_INCLUDES} ${PCRE_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/sql
${MY_READLINE_INCLUDE_DIR} ${MY_READLINE_INCLUDE_DIR}
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment