mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 08:46:41 +01:00
CMake improve find third-party libraries (#2478)
* Improve find thirdparty cmake module. Cleanup cmake build system * Add additional settings for thirdparty paths and fix windows build * Improve cmake getting started doc * Fix postgresql build * Add additional path for odbc windows kits
This commit is contained in:
parent
0dbb8979d0
commit
e624b3315c
@ -15,9 +15,11 @@ target_include_directories(mod_poco
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
PRIVATE
|
||||
${APACHE2_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net)
|
||||
target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net Apache::Apr Apache::Aprutil)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
|
@ -82,13 +82,15 @@ endif()
|
||||
|
||||
if(ENABLE_APACHECONNECTOR)
|
||||
find_package(APR REQUIRED)
|
||||
find_package(Apache2 REQUIRED)
|
||||
find_package(APRUTIL REQUIRED)
|
||||
find_package(Apache2 REQUIRED)
|
||||
else()
|
||||
find_package(APR)
|
||||
find_package(Apache2)
|
||||
find_package(APRUTIL)
|
||||
find_package(Apache2)
|
||||
endif()
|
||||
|
||||
if(APRUTIL_FOUND AND APACHE_FOUND AND
|
||||
if(APR_FOUND AND APRUTIL_FOUND AND APACHE2_FOUND AND
|
||||
EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR)
|
||||
option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON)
|
||||
else()
|
||||
@ -115,7 +117,7 @@ else()
|
||||
find_package(PostgreSQL)
|
||||
endif()
|
||||
|
||||
if(POSTGRESQL_FOUND)
|
||||
if(PostgreSQL_FOUND)
|
||||
option(ENABLE_DATA "Enable SQL" ON)
|
||||
option(ENABLE_DATA_POSTGRESQL "Enable SQL PosgreSQL" ON)
|
||||
else()
|
||||
@ -365,7 +367,6 @@ endif()
|
||||
|
||||
if(APRUTIL_FOUND AND APACHE_FOUND AND
|
||||
EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR)
|
||||
include_directories( "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) # TODO(Bjoe) use target_include_directories or target_link_libraries
|
||||
add_subdirectory(ApacheConnector)
|
||||
list(APPEND Poco_COMPONENTS "ApacheConnector")
|
||||
endif()
|
||||
|
@ -41,7 +41,6 @@ else(ENABLE_DATA_SQLITE)
|
||||
endif()
|
||||
|
||||
if(MYSQL_FOUND AND ENABLE_DATA_MYSQL)
|
||||
include_directories("${MYSQL_INCLUDE_DIR}") # TODO(Bjoe) use target_include_directories or target_link_libraries
|
||||
message(STATUS "MySQL Support Enabled")
|
||||
add_subdirectory( MySQL )
|
||||
else()
|
||||
@ -49,25 +48,17 @@ else()
|
||||
endif()
|
||||
|
||||
if(POSTGRESQL_FOUND AND ENABLE_DATA_POSTGRESQL)
|
||||
include_directories("${PostgreSQL_INCLUDE_DIR}") # TODO(Bjoe) Use target_link_libraries()
|
||||
message(STATUS "PostgreSQL Support Enabled")
|
||||
add_subdirectory( PostgreSQL )
|
||||
else()
|
||||
message(STATUS "PostgreSQL Support Disabled - no PostgreSQL library")
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT WINCE AND ENABLE_DATA_ODBC)
|
||||
set(ODBC_LIBRARIES "odbc32" "odbccp32") # TODO(Bjoe) Verify if this is not set via find_package(ODBC)
|
||||
message(STATUS "Windows native ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else()
|
||||
if(ODBC_FOUND AND ENABLE_DATA_ODBC)
|
||||
include_directories("${ODBC_INCLUDE_DIRECTORIES}") # TODO(Bjoe) use target_include_directories or target_link_libraries
|
||||
if(ODBC_FOUND AND ENABLE_DATA_ODBC AND NOT WINCE)
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else()
|
||||
else()
|
||||
message(STATUS "ODBC Support Disabled - no ODBC runtime")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
|
@ -15,7 +15,7 @@ set_target_properties(DataMySQL
|
||||
DEFINE_SYMBOL MySQL_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(DataMySQL PUBLIC Poco::Data ${MYSQL_LIB})
|
||||
target_link_libraries(DataMySQL PUBLIC Poco::Data MySQL::client)
|
||||
target_include_directories(DataMySQL
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
@ -15,14 +15,14 @@ set_target_properties(DataODBC
|
||||
DEFINE_SYMBOL ODBC_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(DataODBC PUBLIC Poco::Data ${ODBC_LIBRARIES})
|
||||
target_link_libraries(DataODBC PUBLIC Poco::Data ODBC::ODBC)
|
||||
target_include_directories(DataODBC
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
target_compile_definitions(DataODBC PUBLIC ${ODBC_CFLAGS} THREADSAFE)
|
||||
target_compile_definitions(DataODBC PUBLIC THREADSAFE)
|
||||
|
||||
POCO_INSTALL(DataODBC)
|
||||
POCO_GENERATE_PACKAGE(DataODBC)
|
||||
|
@ -15,12 +15,13 @@ set_target_properties(DataPostgreSQL
|
||||
DEFINE_SYMBOL PostgreSQL_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(DataPostgreSQL PUBLIC Poco::Data ${PostgreSQL_LIBRARIES})
|
||||
target_link_libraries(DataPostgreSQL PUBLIC Poco::Data PostgreSQL::client)
|
||||
target_include_directories(DataPostgreSQL
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
POCO_INSTALL(DataPostgreSQL)
|
||||
|
@ -1,94 +1,85 @@
|
||||
# -*- cmake -*-
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# - Find Apache Portable Runtime
|
||||
# Find the APR includes and libraries
|
||||
# This module defines
|
||||
# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
|
||||
# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
|
||||
# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
|
||||
# also defined, but not for general use are
|
||||
# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
|
||||
#.rst:
|
||||
# FindAPR
|
||||
# -------
|
||||
#
|
||||
# Find Apache Portable Runtime
|
||||
#
|
||||
# This will define the following variables::
|
||||
#
|
||||
# APR_FOUND - True if the system has the libraries
|
||||
# APR_INCLUDE_DIRS - where to find the headers
|
||||
# APR_LIBRARIES - where to find the libraries
|
||||
# APR_DEFINITIONS - compile definitions
|
||||
#
|
||||
# and the following imported targets::
|
||||
#
|
||||
# Apache::Apr - The library
|
||||
#
|
||||
# Hints:
|
||||
# Set ``APR_ROOT_DIR`` to the root directory of an installation.
|
||||
#
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# APR first.
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_APR QUIET apr-1)
|
||||
|
||||
FIND_PATH(APR_INCLUDE_DIR apr.h
|
||||
/usr/local/include/apr-1
|
||||
/usr/local/include/apr-1.0
|
||||
/usr/include/apr-1
|
||||
/usr/include/apr-1.0
|
||||
find_path(APR_INCLUDE_DIR apr.h
|
||||
HINTS
|
||||
${APR_ROOT_DIR}/include
|
||||
${APR_ROOT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
${PC_APR_INCLUDE_DIRS}
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
PATH_SUFFIXES
|
||||
apr-1
|
||||
apr-1.0
|
||||
)
|
||||
|
||||
SET(APR_NAMES ${APR_NAMES} apr-1)
|
||||
FIND_LIBRARY(APR_LIBRARY
|
||||
NAMES ${APR_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
find_library(APR_LIBRARY
|
||||
NAMES apr-1 ${APR_NAMES}
|
||||
HINTS
|
||||
${APR_ROOT_DIR}/lib
|
||||
${APR_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_APR_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
IF (APR_LIBRARY AND APR_INCLUDE_DIR)
|
||||
SET(APR_LIBRARIES ${APR_LIBRARY})
|
||||
SET(APR_FOUND "YES")
|
||||
ELSE (APR_LIBRARY AND APR_INCLUDE_DIR)
|
||||
SET(APR_FOUND "NO")
|
||||
ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR)
|
||||
set(APR_VERSION ${PC_APR_VERSION})
|
||||
|
||||
|
||||
IF (APR_FOUND)
|
||||
IF (NOT APR_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}")
|
||||
ENDIF (NOT APR_FIND_QUIETLY)
|
||||
ELSE (APR_FOUND)
|
||||
IF (APR_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find APR library")
|
||||
ENDIF (APR_FIND_REQUIRED)
|
||||
ENDIF (APR_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
APR_LIBRARY
|
||||
APR_INCLUDE_DIR
|
||||
)
|
||||
|
||||
# Next, APRUTIL.
|
||||
|
||||
FIND_PATH(APRUTIL_INCLUDE_DIR apu.h
|
||||
/usr/local/include/apr-1
|
||||
/usr/local/include/apr-1.0
|
||||
/usr/include/apr-1
|
||||
/usr/include/apr-1.0
|
||||
find_package_handle_standard_args(APR
|
||||
FOUND_VAR APR_FOUND
|
||||
REQUIRED_VARS
|
||||
APR_INCLUDE_DIR
|
||||
APR_LIBRARY
|
||||
VERSION_VAR APR_VERSION
|
||||
)
|
||||
|
||||
SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1)
|
||||
FIND_LIBRARY(APRUTIL_LIBRARY
|
||||
NAMES ${APRUTIL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
if(APR_FOUND)
|
||||
set(APR_LIBRARIES ${APR_LIBRARY})
|
||||
set(APR_INCLUDE_DIRS ${APR_INCLUDE_DIR})
|
||||
set(APR_DEFINITIONS ${PC_APR_CFLAGS_OTHER})
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
|
||||
endif()
|
||||
|
||||
if(APR_FOUND AND NOT TARGET Apache::Apr)
|
||||
add_library(Apache::Apr UNKNOWN IMPORTED)
|
||||
set_target_properties(Apache::Apr PROPERTIES
|
||||
IMPORTED_LOCATION "${APR_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_APR_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${APR_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
|
||||
SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY})
|
||||
SET(APRUTIL_FOUND "YES")
|
||||
ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
|
||||
SET(APRUTIL_FOUND "NO")
|
||||
ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
|
||||
|
||||
|
||||
IF (APRUTIL_FOUND)
|
||||
IF (NOT APRUTIL_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}")
|
||||
ENDIF (NOT APRUTIL_FIND_QUIETLY)
|
||||
ELSE (APRUTIL_FOUND)
|
||||
IF (APRUTIL_FIND_REQUIRED)
|
||||
MESSAGE(STATUS "Could not find APRUTIL library")
|
||||
ENDIF (APRUTIL_FIND_REQUIRED)
|
||||
ENDIF (APRUTIL_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
APRUTIL_LIBRARY
|
||||
APRUTIL_INCLUDE_DIR
|
||||
)
|
||||
mark_as_advanced(
|
||||
APR_LIBRARY
|
||||
APR_INCLUDE_DIR
|
||||
)
|
||||
|
81
cmake/FindAPRUTIL.cmake
Normal file
81
cmake/FindAPRUTIL.cmake
Normal file
@ -0,0 +1,81 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindAPRUTIL
|
||||
# -------
|
||||
#
|
||||
# Find Apache Portable Runtime
|
||||
#
|
||||
# This will define the following variables::
|
||||
#
|
||||
# APRUTIL_FOUND - True if the system has the libraries
|
||||
# APRUTIL_INCLUDE_DIRS - where to find the headers
|
||||
# APRUTIL_LIBRARIES - where to find the libraries
|
||||
# APRUTIL_DEFINITIONS - compile definitons
|
||||
#
|
||||
# Hints:
|
||||
# Set ``APRUTIL_ROOT_DIR`` to the root directory of an installation.
|
||||
#
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_APRUTIL QUIET apr-util-1)
|
||||
|
||||
find_path(APRUTIL_INCLUDE_DIR apu.h
|
||||
HINTS
|
||||
${APRUTIL_ROOT_DIR}/include
|
||||
${APRUTIL_ROOT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
${PC_APRUTIL_INCLUDE_DIRS}
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
PATH_SUFFIXES
|
||||
apr-1
|
||||
apr-1.0
|
||||
)
|
||||
|
||||
find_library(APRUTIL_LIBRARY
|
||||
NAMES aprutil-1 ${APRUTIL_NAMES}
|
||||
HINTS
|
||||
${APRUTIL_ROOT_DIR}/lib
|
||||
${APRUTIL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_APRUTIL_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
set(APRUTIL_VERSION ${PC_APRUTIL_VERSION})
|
||||
|
||||
find_package_handle_standard_args(APRUTIL
|
||||
FOUND_VAR APRUTIL_FOUND
|
||||
REQUIRED_VARS
|
||||
APRUTIL_INCLUDE_DIR
|
||||
APRUTIL_LIBRARY
|
||||
VERSION_VAR APRUTIL_VERSION
|
||||
)
|
||||
|
||||
if(APRUTIL_FOUND)
|
||||
set(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY})
|
||||
set(APRUTIL_INCLUDE_DIRS ${APRUTIL_INCLUDE_DIR})
|
||||
set(APRUTIL_DEFINITIONS ${PC_APRUTIL_CFLAGS_OTHER})
|
||||
|
||||
# Deprecated declarations.
|
||||
SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} )
|
||||
GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH)
|
||||
endif()
|
||||
|
||||
if(APRUTIL_FOUND AND NOT TARGET Apache::Aprutil)
|
||||
add_library(Apache::Aprutil UNKNOWN IMPORTED)
|
||||
set_target_properties(Apache::Aprutil PROPERTIES
|
||||
IMPORTED_LOCATION "${APRUTIL_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_APRUTIL_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${APRUTIL_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
APRUTIL_LIBRARY
|
||||
APRUTIL_INCLUDE_DIR
|
||||
)
|
@ -1,31 +1,49 @@
|
||||
# -*- cmake -*-
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# - Find Apache Runtime
|
||||
# Find the APACHE includes and libraries
|
||||
# This module defines
|
||||
# APACHE_INCLUDE_DIR and APACHEUTIL_INCLUDE_DIR, where to find APACHE.h, etc.
|
||||
# APACHE_LIBRARIES and APACHEUTIL_LIBRARIES, the libraries needed to use APACHE.
|
||||
# APACHE_FOUND and APACHEUTIL_FOUND, If false, do not try to use APACHE.
|
||||
# also defined, but not for general use are
|
||||
# APACHE_LIBRARY and APACHEUTIL_LIBRARY, where to find the APACHE library.
|
||||
#.rst:
|
||||
# FindApache2
|
||||
# -------
|
||||
#
|
||||
# Find Apache2 Runtime
|
||||
#
|
||||
# This will define the following variables::
|
||||
#
|
||||
# APACHE2_FOUND - True if the system has the Apache2 library
|
||||
# APACHE2_INCLUDE_DIRS - where to find httpd.h, etc.
|
||||
#
|
||||
# Hints:
|
||||
# Set ``APACHE2_ROOT_DIR`` to the root directory of an Apache installation.
|
||||
#
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PATH(APACHE_INCLUDE_DIR httpd.h
|
||||
/usr/local/include/apache2
|
||||
/usr/include/apache2
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_APACHE2 QUIET apache2)
|
||||
|
||||
find_path(APACHE2_INCLUDE_DIR httpd.h
|
||||
HINTS
|
||||
${APACHE2_ROOT_DIR}/include/apache2
|
||||
${APACHE2_ROOT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
${PC_APACHE2_INCLUDE_DIRS}
|
||||
/usr/local/include/apache2
|
||||
/usr/include/apache2
|
||||
)
|
||||
|
||||
IF (APACHE_INCLUDE_DIR)
|
||||
SET(APACHE_FOUND "YES")
|
||||
ELSE (APACHE_LIBRARY AND APACHE_INCLUDE_DIR)
|
||||
SET(APACHE_FOUND "NO")
|
||||
ENDIF (APACHE_INCLUDE_DIR)
|
||||
set(APACHE2_VERSION ${PC_APACHE2_VERSION})
|
||||
|
||||
find_package_handle_standard_args(Apache2
|
||||
FOUND_VAR APACHE2_FOUND
|
||||
REQUIRED_VARS
|
||||
APACHE2_INCLUDE_DIR
|
||||
VERSION_VAR APACHE2_VERSION
|
||||
)
|
||||
|
||||
IF (APACHE_FOUND)
|
||||
MESSAGE(STATUS "Found APACHE: ${APACHE_INCLUDE_DIR}")
|
||||
ENDIF (APACHE_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
APACHE_INCLUDE_DIR
|
||||
)
|
||||
if(APACHE2_FOUND)
|
||||
set(APACHE2_INCLUDE_DIRS ${APACHE2_INCLUDE_DIR})
|
||||
set(APACHE2_DEFINITIONS ${PC_APACHE2_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
APACHE2_INCLUDE_DIR
|
||||
)
|
||||
|
@ -1,30 +1,51 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindMySQL
|
||||
# -------
|
||||
#
|
||||
# Find MySQL Runtime
|
||||
#
|
||||
# This will define the following variables::
|
||||
#
|
||||
# MYSQL_FOUND - True if the system has the libraries
|
||||
# MYSQL_INCLUDE_DIRS - where to find the headers
|
||||
# MYSQL_LIBRARIES - where to find the libraries
|
||||
# MYSQL_DEFINITIONS - compile definitons
|
||||
#
|
||||
# Hints:
|
||||
# Set ``MYSQL_ROOT_DIR`` to the root directory of an installation.
|
||||
#
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_MYSQL QUIET mysqlclient)
|
||||
pkg_check_modules(PC_MARIADB QUIET mariadb)
|
||||
|
||||
SET(BINDIR32_ENV_NAME "ProgramFiles(x86)")
|
||||
SET(BINDIR32 $ENV{${BINDIR32_ENV_NAME}})
|
||||
|
||||
find_path(MYSQL_INCLUDE_DIR mysql.h
|
||||
/usr/include/mysql
|
||||
/usr/local/include/mysql
|
||||
HINTS
|
||||
${MYSQL_ROOT_DIR}/include
|
||||
${MYSQL_ROOT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
${PC_MYSQL_INCLUDE_DIRS}
|
||||
${PC_MARIADB_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/mysql/mysql/include
|
||||
/opt/mysql/mysql/include/mysql
|
||||
/usr/local/mysql/include
|
||||
/usr/local/mysql/include/mysql
|
||||
$ENV{MYSQL_INCLUDE_DIR}
|
||||
$ENV{MYSQL_DIR}/include
|
||||
$ENV{ProgramFiles}/MySQL/*/include
|
||||
${BINDIR32}/MySQL/include
|
||||
$ENV{SystemDrive}/MySQL/*/include)
|
||||
|
||||
if (NOT MYSQL_INCLUDE_DIR)
|
||||
find_path(MARIADB_INCLUDE_DIR mysql.h
|
||||
/usr/include/mariadb
|
||||
/usr/local/include/mariadb
|
||||
/opt/mariadb/mariadb/include
|
||||
/opt/mariadb/mariadb/include/mariadb
|
||||
/usr/local/mariadb/include
|
||||
/usr/local/mariadb/include/mariadb
|
||||
$ENV{MARIADB_INCLUDE_DIR}
|
||||
$ENV{MARIADB_DIR}/include)
|
||||
endif (NOT MYSQL_INCLUDE_DIR)
|
||||
$ENV{SystemDrive}/MySQL/*/include
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
mariadb
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
@ -33,62 +54,69 @@ if (WIN32)
|
||||
else (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(libsuffixDist opt)
|
||||
set(libsuffixBuild Release)
|
||||
add_definitions(-DDBUG_OFF)
|
||||
set(WIN_MYSQL_DEFINITONS " -DDBUG_OFF")
|
||||
endif (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
||||
find_library(MYSQL_LIB NAMES mysqlclient
|
||||
find_library(MYSQL_LIBRARY NAMES mysqlclient
|
||||
HINTS
|
||||
${MYSQL_ROOT_DIR}/lib/${libsuffixDist}
|
||||
${MYSQL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
$ENV{MYSQL_DIR}/lib/${libsuffixDist}
|
||||
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
|
||||
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
||||
${BINDIR32}/MySQL/lib
|
||||
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
|
||||
else (WIN32)
|
||||
find_library(MYSQL_LIB NAMES mysqlclient mysqlclient_r
|
||||
${PC_MYSQL_LIBRARY_DIRS}
|
||||
${PC_MARIADB_LIBRARY_DIRS}
|
||||
$ENV{MYSQL_DIR}/lib/${libsuffixDist}
|
||||
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
|
||||
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
||||
${BINDIR32}/MySQL/lib
|
||||
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}
|
||||
)
|
||||
else()
|
||||
find_library(MYSQL_LIBRARY NAMES mysqlclient mysqlclient_r mariadbclient
|
||||
HINTS
|
||||
${MYSQL_ROOT_DIR}/lib
|
||||
${MYSQL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib/mysql
|
||||
/usr/local/lib/mysql
|
||||
/usr/local/mysql/lib
|
||||
/usr/local/mysql/lib/mysql
|
||||
/opt/mysql/mysql/lib
|
||||
/opt/mysql/mysql/lib/mysql
|
||||
$ENV{MYSQL_DIR}/libmysql_r/.libs
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
$ENV{MYSQL_DIR}/lib/mysql)
|
||||
${PC_MYSQL_LIBRARY_DIRS}
|
||||
${PC_MARIADB_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/local/mysql/lib
|
||||
/opt/mysql/mysql/lib
|
||||
$ENV{MYSQL_DIR}/libmysql_r/.libs
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
mariadb
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT MYSQL_LIB)
|
||||
find_library(MARIADB_LIB NAMES mariadbclient
|
||||
PATHS
|
||||
/usr/lib/mariadb
|
||||
/usr/local/lib/mariadb
|
||||
/usr/local/mariadb/lib
|
||||
/usr/local/mariadb/lib/mariadb
|
||||
/opt/mariadb/mariadb/lib
|
||||
/opt/mariadb/mariadb/lib/mariadb
|
||||
$ENV{MARIADB_DIR}/libmariadb/.libs
|
||||
$ENV{MARIADB_DIR}/lib
|
||||
$ENV{MARIADB_DIR}/lib/mariadb)
|
||||
endif (NOT MYSQL_LIB)
|
||||
endif (WIN32)
|
||||
set(MYSQL_VERSION ${PC_MYSQL_VERSION})
|
||||
|
||||
if (MYSQL_INCLUDE_DIR AND MYSQL_LIB)
|
||||
get_filename_component(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
|
||||
set(MYSQL_FOUND TRUE)
|
||||
message(STATUS "Found MySQL Include directory: ${MYSQL_INCLUDE_DIR} library directory: ${MYSQL_LIB_DIR}")
|
||||
include_directories(${MYSQL_INCLUDE_DIR})
|
||||
link_directories(${MYSQL_LIB_DIR})
|
||||
elseif((MARIADB_INCLUDE_DIR OR MYSQL_INCLUDE_DIR) AND MARIADB_LIB)
|
||||
get_filename_component(MYSQL_LIB_DIR ${MARIADB_LIB} PATH)
|
||||
set(MYSQL_FOUND TRUE)
|
||||
set(MYSQL_LIB ${MARIADB_LIB})
|
||||
if(MARIADB_INCLUDE_DIR)
|
||||
set(MYSQL_INCLUDE_DIR ${MARIADB_INCLUDE_DIR})
|
||||
endif(MARIADB_INCLUDE_DIR)
|
||||
message(STATUS "Found MariaDB Include directory: ${MYSQL_INCLUDE_DIR} library directory: ${MYSQL_LIB_DIR}")
|
||||
message(STATUS "Use MariaDB for MySQL Support")
|
||||
include_directories(${MYSQL_INCLUDE_DIR} )
|
||||
link_directories(${MYSQL_LIB_DIR})
|
||||
else ((MARIADB_INCLUDE_DIR OR MYSQL_INCLUDE_DIR) AND MARIADB_LIB)
|
||||
message(STATUS "Couldn't find MySQL or MariaDB")
|
||||
endif (MYSQL_INCLUDE_DIR AND MYSQL_LIB)
|
||||
find_package_handle_standard_args(MYSQL
|
||||
FOUND_VAR MYSQL_FOUND
|
||||
REQUIRED_VARS
|
||||
MYSQL_INCLUDE_DIR
|
||||
MYSQL_LIBRARY
|
||||
VERSION_VAR MYSQL_VERSION
|
||||
)
|
||||
|
||||
if(MYSQL_FOUND)
|
||||
set(MYSQL_LIBRARIES ${MYSQL_LIBRARY})
|
||||
set(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIR})
|
||||
set(MYSQL_DEFINITIONS "${PC_MYSQL_CFLAGS_OTHER}${WIN_MYSQL_DEFINITONS}")
|
||||
endif()
|
||||
|
||||
if(MYSQL_FOUND AND NOT TARGET MySQL::client)
|
||||
add_library(MySQL::client UNKNOWN IMPORTED)
|
||||
set_target_properties(MySQL::client PROPERTIES
|
||||
IMPORTED_LOCATION "${MYSQL_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_MYSQL_CFLAGS_OTHER}${WIN_MYSQL_DEFINITONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MYSQL_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
MYSQL_LIBRARY
|
||||
MYSQL_INCLUDE_DIR
|
||||
)
|
||||
|
@ -1,61 +1,142 @@
|
||||
#
|
||||
# Find the ODBC driver manager includes and library.
|
||||
#
|
||||
# ODBC is an open standard for connecting to different databases in a
|
||||
# semi-vendor-independent fashion. First you install the ODBC driver
|
||||
# manager. Then you need a driver for each separate database you want
|
||||
# to connect to (unless a generic one works). VTK includes neither
|
||||
# the driver manager nor the vendor-specific drivers: you have to find
|
||||
# those yourself.
|
||||
#
|
||||
# This module defines
|
||||
# ODBC_INCLUDE_DIRECTORIES, where to find sql.h
|
||||
# ODBC_LIBRARIES, the libraries to link against to use ODBC
|
||||
# ODBC_FOUND. If false, you cannot build anything that requires MySQL.
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
find_path(ODBC_INCLUDE_DIRECTORIES
|
||||
#.rst:
|
||||
# FindMySQL
|
||||
# -------
|
||||
#
|
||||
# Find ODBC Runtime
|
||||
#
|
||||
# This will define the following variables::
|
||||
#
|
||||
# ODBC_FOUND - True if the system has the libraries
|
||||
# ODBC_INCLUDE_DIRS - where to find the headers
|
||||
# ODBC_LIBRARIES - where to find the libraries
|
||||
# ODBC_DEFINITIONS - compile definitons
|
||||
#
|
||||
# Hints:
|
||||
# Set ``ODBC_ROOT_DIR`` to the root directory of an installation.
|
||||
#
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_ODBC QUIET odbc)
|
||||
|
||||
if(WIN32)
|
||||
get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
|
||||
get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
|
||||
endif()
|
||||
|
||||
find_path(ODBC_INCLUDE_DIR
|
||||
NAMES sql.h
|
||||
HINTS
|
||||
/usr/include
|
||||
/usr/include/odbc
|
||||
/usr/include/iodbc
|
||||
/usr/local/include
|
||||
/usr/local/include/odbc
|
||||
/usr/local/include/iodbc
|
||||
/usr/local/odbc/include
|
||||
/usr/local/iodbc/include
|
||||
"C:/Program Files/ODBC/include"
|
||||
"C:/Program Files/Microsoft SDKs/Windows/v7.0/include"
|
||||
"C:/Program Files/Microsoft SDKs/Windows/v6.0a/include"
|
||||
"C:/ODBC/include"
|
||||
${ODBC_ROOT_DIR}/include
|
||||
${ODBC_ROOT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
${PC_ODBC_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/local/odbc/include
|
||||
/usr/local/iodbc/include
|
||||
"C:/Program Files/ODBC/include"
|
||||
"C:/Program Files/Microsoft SDKs/Windows/v7.0/include"
|
||||
"C:/Program Files/Microsoft SDKs/Windows/v6.0a/include"
|
||||
"C:/ODBC/include"
|
||||
"${kit_dir}/Include/um"
|
||||
"${kit81_dir}/Include/um"
|
||||
PATH_SUFFIXES
|
||||
odbc
|
||||
iodbc
|
||||
DOC "Specify the directory containing sql.h."
|
||||
)
|
||||
|
||||
find_library(ODBC_LIBRARIES
|
||||
NAMES iodbc odbc odbcinst odbc32
|
||||
if(NOT ODBC_INCLUDE_DIR AND WIN32)
|
||||
set(ODBC_INCLUDE_DIR "")
|
||||
else()
|
||||
set(REQUIRED_INCLUDE_DIR ODBC_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
find_library(ODBC_LIBRARY
|
||||
NAMES unixodbc iodbc odbc odbc32
|
||||
HINTS
|
||||
/usr/lib
|
||||
/usr/lib/odbc
|
||||
/usr/local/lib
|
||||
/usr/local/lib/odbc
|
||||
/usr/local/odbc/lib
|
||||
"C:/Program Files/ODBC/lib"
|
||||
"C:/ODBC/lib/debug"
|
||||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"
|
||||
${ODBC_ROOT_DIR}/lib
|
||||
${ODBC_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_ODBC_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/local/odbc/lib
|
||||
"C:/Program Files/ODBC/lib"
|
||||
"C:/ODBC/lib/debug"
|
||||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"
|
||||
"${kit81_dir}/Lib/winv6.3/um/x64"
|
||||
"${kit_dir}/Lib/win8/um/x64"
|
||||
"${kit81_dir}/Lib/winv6.3/um/x86"
|
||||
"${kit_dir}/Lib/win8/um/x86"
|
||||
PATH_SUFIXES
|
||||
odbc
|
||||
DOC "Specify the ODBC driver manager library here."
|
||||
)
|
||||
|
||||
# MinGW find usually fails
|
||||
if(MINGW)
|
||||
set(ODBC_INCLUDE_DIRECTORIES ".")
|
||||
set(ODBC_LIBRARIES odbc32)
|
||||
if(NOT ODBC_LIBRARY AND WIN32)
|
||||
# List names of ODBC libraries on Windows
|
||||
set(ODBC_LIBRARY odbc32.lib)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ODBC
|
||||
DEFAULT_MSG
|
||||
ODBC_INCLUDE_DIRECTORIES
|
||||
ODBC_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(ODBC_FOUND ODBC_LIBRARIES ODBC_INCLUDE_DIRECTORIES)
|
||||
# List additional libraries required to use ODBC library
|
||||
if(WIN32 AND MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
set(_odbc_required_libs_names odbccp32;ws2_32)
|
||||
elseif(MINGW)
|
||||
set(_odbc_required_libs_names odbccp32)
|
||||
endif()
|
||||
foreach(_lib_name IN LISTS _odbc_required_libs_names)
|
||||
find_library(_lib_path
|
||||
NAMES ${_lib_name}
|
||||
HINTS
|
||||
${ODBC_ROOT_DIR}/lib
|
||||
${ODBC_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_ODBC_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/local/odbc/lib
|
||||
"C:/Program Files/ODBC/lib"
|
||||
"C:/ODBC/lib/debug"
|
||||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"
|
||||
PATH_SUFFIXES
|
||||
odbc
|
||||
)
|
||||
if (_lib_path)
|
||||
list(APPEND _odbc_required_libs_paths ${_lib_path})
|
||||
endif()
|
||||
unset(_lib_path CACHE)
|
||||
endforeach()
|
||||
unset(_odbc_lib_paths)
|
||||
unset(_odbc_required_libs_names)
|
||||
|
||||
|
||||
find_package_handle_standard_args(ODBC
|
||||
FOUND_VAR ODBC_FOUND
|
||||
REQUIRED_VARS
|
||||
ODBC_LIBRARY
|
||||
${REQUIRED_INCLUDE_DIR}
|
||||
VERSION_VAR ODBC_VERSION
|
||||
)
|
||||
|
||||
if(ODBC_FOUND)
|
||||
set(ODBC_LIBRARIES ${ODBC_LIBRARY} ${_odbc_required_libs_paths})
|
||||
set(ODBC_INCLUDE_DIRS ${ODBC_INCLUDE_DIR})
|
||||
set(ODBC_DEFINITIONS ${PC_ODBC_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(ODBC_FOUND AND NOT TARGET ODBC::ODBC)
|
||||
add_library(ODBC::ODBC UNKNOWN IMPORTED)
|
||||
set_target_properties(ODBC::ODBC PROPERTIES
|
||||
IMPORTED_LOCATION "${ODBC_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES "${_odbc_required_libs_paths}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_ODBC_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ODBC_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDE_DIR)
|
||||
|
@ -15,7 +15,7 @@
|
||||
# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking
|
||||
# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers
|
||||
# PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries
|
||||
# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8)
|
||||
# PostgreSQL_VERSION - the version of PostgreSQL found (since CMake 2.8.8)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# History:
|
||||
@ -38,6 +38,7 @@
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# You may need to manually set:
|
||||
# PostgreSQL_ROOT_DIR - that points to the root of where you have installed PostgreSQL
|
||||
# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are.
|
||||
# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are.
|
||||
# If FindPostgreSQL.cmake cannot find the include files or the library files.
|
||||
@ -59,7 +60,7 @@
|
||||
# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path()
|
||||
# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file
|
||||
# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
|
||||
# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have
|
||||
# 3) Set an environment variable called ${PostgreSQL_ROOT} / ${PostgreSQL_ROOT_DIR} that points to the root of where you have
|
||||
# installed PostgreSQL, e.g. <Your Path>.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -78,6 +79,7 @@ set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
|
||||
set( PostgreSQL_ROOT_DIRECTORIES
|
||||
ENV PostgreSQL_ROOT
|
||||
${PostgreSQL_ROOT}
|
||||
${PostgreSQL_ROOT_DIR}
|
||||
)
|
||||
foreach(suffix ${PostgreSQL_KNOWN_VERSIONS})
|
||||
if(WIN32)
|
||||
@ -111,6 +113,8 @@ endif()
|
||||
#
|
||||
find_path(PostgreSQL_INCLUDE_DIR
|
||||
NAMES libpq-fe.h
|
||||
HINTS
|
||||
${PostgreSQL_ROOT_INCLUDE_DIRS}
|
||||
PATHS
|
||||
# Look in other places.
|
||||
${PostgreSQL_ROOT_DIRECTORIES}
|
||||
@ -150,6 +154,8 @@ endif()
|
||||
|
||||
find_library(PostgreSQL_LIBRARY
|
||||
NAMES ${PostgreSQL_LIBRARY_TO_FIND}
|
||||
HINTS
|
||||
${PostgreSQL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PostgreSQL_ROOT_DIRECTORIES}
|
||||
PATH_SUFFIXES
|
||||
@ -171,7 +177,7 @@ if (PostgreSQL_INCLUDE_DIR)
|
||||
REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
|
||||
if(pgsql_version_str)
|
||||
string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
|
||||
"\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
|
||||
"\\1" PostgreSQL_VERSION "${pgsql_version_str}")
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
@ -183,7 +189,7 @@ endif()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PostgreSQL
|
||||
REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR #PostgreSQL_TYPE_INCLUDE_DIR
|
||||
VERSION_VAR PostgreSQL_VERSION_STRING)
|
||||
VERSION_VAR PostgreSQL_VERSION)
|
||||
set(PostgreSQL_FOUND ${POSTGRESQL_FOUND})
|
||||
|
||||
# Now try to get the include and library path.
|
||||
@ -193,4 +199,12 @@ if(PostgreSQL_FOUND)
|
||||
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(PostgreSQL_FOUND AND NOT TARGET PostgreSQL::client)
|
||||
add_library(PostgreSQL::client UNKNOWN IMPORTED)
|
||||
set_target_properties(PostgreSQL::client PROPERTIES
|
||||
IMPORTED_LOCATION "${PostgreSQL_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PostgreSQL_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_LIBRARY ) #PostgreSQL_TYPE_INCLUDE_DIR
|
||||
|
@ -395,6 +395,55 @@ or for console only:
|
||||
|
||||
POCO C++ Libraries options are prefixed with <*ENABLE_*>. (This will be changed in POCO 2.x.x to <*POCO_*>)
|
||||
|
||||
!!!Third-party library location
|
||||
|
||||
If a third-party library is not installed in a default location, cmake will fail to run.
|
||||
There exists following parameters to set additional search paths for cmake to find third-party libraries:
|
||||
|
||||
To find PostgreSQL:
|
||||
* PostgreSQL_ROOT_DIR - Set root installation path where to find include path and libraries of PostgreSQL
|
||||
or
|
||||
* PostgreSQL_ROOT_INCLUDE_DIRS - Set include paths where to find PostgreSQL headers
|
||||
* PostgreSQL_ROOT_LIBRARY_DIRS - Set library paths where to find PostgreSQL libraries
|
||||
|
||||
To find ODBC:
|
||||
* ODBC_ROOT_DIR - Set root installation path where to find include path and libraries of ODBC
|
||||
or
|
||||
* ODBC_ROOT_INCLUDE_DIRS - Set include paths where to find ODBC headers
|
||||
* ODBC_ROOT_LIBRARY_DIRS - Set library paths where to find ODBC libraries
|
||||
|
||||
To find MySQL or MariaDB:
|
||||
* MYSQL_ROOT_DIR - Set root installation path where to find include path and libraries of MySQL or MariaDB
|
||||
or
|
||||
* MYSQL_ROOT_INCLUDE_DIRS - Set include paths where to find MySQL or MariaDB headers
|
||||
* MYSQL_ROOT_LIBRARY_DIRS - Set library paths where to find MySQL or MariaDB libraries
|
||||
|
||||
* APRUTIL_ROOT_DIR - Set root installation path where to find include path and libraries of apr util
|
||||
or
|
||||
* APRUTIL_ROOT_INCLUDE_DIRS - Set include paths where to find apr util headers
|
||||
* APRUTIL_ROOT_LIBRARY_DIRS - Set library paths where to find apr util libraries
|
||||
|
||||
* APR_ROOT_DIR - Set root installation path where to find include path and libraries of apr
|
||||
or
|
||||
* APR_ROOT_INCLUDE_DIRS - Set include paths where to find apr headers
|
||||
* APR_ROOT_LIBRARY_DIRS - Set library paths where to find apr libraries
|
||||
|
||||
* APACHE2_ROOT_DIR - Set root installation path where to find include path and libraries of apache2
|
||||
or
|
||||
* APACHE2_ROOT_INCLUDE_DIRS - Set include paths where to find apache2 headers
|
||||
|
||||
|
||||
For example set installation path of MySQL:
|
||||
|
||||
$ cmake -H/path/to/poco -B/path/to/poco-build -DMYSQL_ROOT_DIR=/usr/local/mysql
|
||||
$ cmake --build /path/to/poco-build
|
||||
or
|
||||
$ cmake -H/path/to/poco -B/path/to/poco-build -DMYSQL_ROOT_INCLUDE_DIRS=/usr/local/mysql/include/mysql -DMYSQL_ROOT_LIBRARY_DIRS=/usr/local/lib/mysql
|
||||
$ cmake --build /path/to/poco-build
|
||||
|
||||
|
||||
|
||||
|
||||
!!!How to use POCO in your cmake project:
|
||||
|
||||
To use POCO C++ Libraries in your cmake project, add following line in your project for example to use crypto:
|
||||
|
Loading…
x
Reference in New Issue
Block a user