mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-10-29 17:52:44 +00:00
Merge cmake changes from poco-1.9.1 (#2505)
* Take changes from 1.9.1 for check cxxyy compiler support * Get change from 1.9.1 branch. _DEBUG is set on Foundation library * CMake improve find third-party libraries (#2478) * Add additional settings for thirdparty paths and fix windows build * Fix postgresql build on AppVeyor * Add additional path for odbc windows kits * Add test_compiler cpp * Take changes from 1.9.1 for find MySQL modul * Take changes from 1.9.1 for find ODBC modul * Take changes from 1.9.1 for find PCRE modul * Take changes from 1.9.1 for find PostgreSQL modul * Take changes from 1.9.1 for find Apache2 modul * Take cmake SQL changes from 1.9.1 * Take changes from 1.9.1 for MySQL cmake * Take changes from 1.9.1 for ODBC cmake * Take changes from 1.9.1 for PostgreSQL cmake * Fix compile with c++11 standard * Rename DISABLE_CPP14 to POCO_DISABLE_CPP14 * Fix cmake compile features * Remove POCO_ENABLE_CPP11 * Enable compile 64bit in cmake for AppVeyor build * Remove copy data directory for encoding test. It doesnt exists anymore * Move __LCC__ define to MySQL
This commit is contained in:
committed by
GitHub
parent
02ec40bb6e
commit
a4a0052cc1
344
CMakeLists.txt
344
CMakeLists.txt
@@ -22,7 +22,6 @@ endif()
|
||||
# top of the build tree rather than in hard-to-find leaf
|
||||
# directories. This simplifies manual testing and the use of the build
|
||||
# tree rather than installed Boost libraries.
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
# Windows DLLs are "runtime" for CMake. Output them to "bin" like the Visual Studio projects do.
|
||||
@@ -34,52 +33,125 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.4")
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/V33)
|
||||
endif()
|
||||
|
||||
#################################################################################
|
||||
# Setup C/C++ compiler options
|
||||
#################################################################################
|
||||
option(DISABLE_CPP14 "Disable C++14 if available" OFF)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (DISABLE_CPP14)
|
||||
add_definitions(-DPOCO_DISABLE_CPP14)
|
||||
else()
|
||||
option(POCO_DISABLE_CPP14 "Disable C++14 if not available" OFF)
|
||||
|
||||
if(NOT POCO_DISABLE_CPP14)
|
||||
# C++14 compiler flags
|
||||
include(CXX1x)
|
||||
check_for_cxx14_compiler(CXX14_COMPILER)
|
||||
|
||||
# If a C++14 compiler is available, then set the appropriate flags
|
||||
if(CXX14_COMPILER)
|
||||
enable_cxx14()
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
else()
|
||||
set(POCO_DISABLE_CPP14 ON CACHE BOOL "Disable C++14 if not available" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
# Include some common macros to simpilfy Poco CMake files
|
||||
# Include some common macros to simpilfy the Poco CMake files
|
||||
include(PocoMacros)
|
||||
|
||||
if(POCO_ENABLE_NETSSL OR POCO_ENABLE_CRYPTO OR (POCO_ENABLE_SQL_MYSQL AND MINGW))
|
||||
find_package(OpenSSL REQUIRED)
|
||||
else()
|
||||
find_package(OpenSSL)
|
||||
endif()
|
||||
|
||||
if(OPENSSL_FOUND)
|
||||
option(POCO_ENABLE_NETSSL "Enable NetSSL" ON)
|
||||
option(POCO_ENABLE_CRYPTO "Enable Crypto" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_NETSSL "Enable NetSSL" OFF)
|
||||
option(POCO_ENABLE_CRYPTO "Enable Crypto" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_APACHECONNECTOR)
|
||||
find_package(APR REQUIRED)
|
||||
find_package(Apache2 REQUIRED)
|
||||
else()
|
||||
find_package(APR)
|
||||
find_package(Apache2)
|
||||
endif()
|
||||
|
||||
if(APRUTIL_FOUND AND APACHE_FOUND)
|
||||
option(POCO_ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SQL_MYSQL)
|
||||
find_package(MySQL REQUIRED)
|
||||
else()
|
||||
find_package(MySQL)
|
||||
endif()
|
||||
|
||||
if(MYSQL_FOUND)
|
||||
option(POCO_ENABLE_SQL "Enable SQL" ON)
|
||||
option(POCO_ENABLE_SQL_MYSQL "Enable SQL MySQL" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_SQL "Enable SQL" OFF)
|
||||
option(POCO_ENABLE_SQL_MYSQL "Enable SQL MySQL" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SQL_POSTGRESQL)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
else()
|
||||
find_package(PostgreSQL)
|
||||
endif()
|
||||
|
||||
if(POSTGRESQL_FOUND)
|
||||
option(POCO_ENABLE_SQL "Enable SQL" ON)
|
||||
option(POCO_ENABLE_SQL_POSTGRESQL "Enable SQL PosgreSQL" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_SQL "Enable SQL" OFF)
|
||||
option(POCO_ENABLE_SQL_POSTGRESQL "Enable SQL PosgreSQL" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SQL_ODBC)
|
||||
find_package(ODBC REQUIRED)
|
||||
else()
|
||||
find_package(ODBC)
|
||||
endif()
|
||||
|
||||
if(ODBC_FOUND)
|
||||
option(POCO_ENABLE_SQL "Enable SQL" ON)
|
||||
option(POCO_ENABLE_SQL_ODBC "Enable SQL ODBC" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_SQL "Enable SQL" OFF)
|
||||
option(POCO_ENABLE_SQL_ODBC "Enable SQL ODBC" OFF)
|
||||
endif()
|
||||
|
||||
# Allow enabling and disabling components
|
||||
option(POCO_ENABLE_CPPUNIT "Enable CppUnit" ON)
|
||||
option(POCO_ENABLE_ENCODINGS "Enable Encodings" ON)
|
||||
option(POCO_ENABLE_ENCODINGS_COMPILER "Enable Encodings Compiler" OFF)
|
||||
option(POCO_ENABLE_XML "Enable XML" ON)
|
||||
option(POCO_ENABLE_JSON "Enable JSON" ON)
|
||||
option(POCO_ENABLE_MONGODB "Enable MongoDB" ON)
|
||||
option(POCO_ENABLE_SQL_SQLITE "Enable SQL SQLite" OFF)
|
||||
option(POCO_ENABLE_REDIS "Enable Redis" ON)
|
||||
option(POCO_ENABLE_PDF "Enable PDF" OFF)
|
||||
option(POCO_ENABLE_UTIL "Enable Util" ON)
|
||||
option(POCO_ENABLE_NET "Enable Net" ON)
|
||||
|
||||
option(POCO_ENABLE_SEVENZIP "Enable SevenZip" OFF)
|
||||
option(POCO_ENABLE_ZIP "Enable Zip" ON)
|
||||
option(POCO_ENABLE_CPPPARSER "Enable C++ parser" OFF)
|
||||
option(POCO_ENABLE_POCODOC "Enable Poco Documentation Generator" OFF)
|
||||
option(POCO_ENABLE_PAGECOMPILER "Enable PageCompiler" ON)
|
||||
option(POCO_ENABLE_PAGECOMPILER_FILE2PAGE "Enable File2Page" ON)
|
||||
option(POCO_ENABLE_WSTRING "Enable std::wstring support" ON)
|
||||
option(POCO_ENABLE_FPENVIRONMENT "Enable floating-point support" ON)
|
||||
|
||||
if(POCO_STATIC)
|
||||
message(DEPRECATION "POCO_STATIC is deprecated and will be removed! Use BUILD_SHARED_LIBS instead")
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
else()
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
endif()
|
||||
option(POCO_ENABLE_CPPUNIT "Enable CppUnit" ON)
|
||||
|
||||
# allow disabling of internally built OpenSSL# (see below for details)
|
||||
# if POCO pre-built OpenSSL directory is found, and POCO_DISABLE_INTERNAL_OPENSSL=OFF,
|
||||
@@ -89,9 +161,9 @@ option(POCO_DISABLE_INTERNAL_OPENSSL "Disable internal OpensSSL binaries use" OF
|
||||
if(MSVC AND (EXISTS "${PROJECT_SOURCE_DIR}/openssl/build/") AND NOT POCO_DISABLE_INTERNAL_OPENSSL)
|
||||
set(OPENSSL_ROOT_DIR "${PROJECT_SOURCE_DIR}/openssl/build/")
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
set(_MSVC_ARCH "64")
|
||||
set(_MSVC_ARCH "64")
|
||||
else()
|
||||
set(_MSVC_ARCH "32")
|
||||
set(_MSVC_ARCH "32")
|
||||
endif()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(_LIB_DIR "bin")
|
||||
@@ -109,100 +181,29 @@ if(MSVC AND (EXISTS "${PROJECT_SOURCE_DIR}/openssl/build/") AND NOT POCO_DISABLE
|
||||
list(APPEND OPENSSL_ROOT_DIR ${INTERNAL_OPENSSL_LIBRARIES})
|
||||
endif(MSVC AND (EXISTS "${PROJECT_SOURCE_DIR}/openssl/build/") AND NOT POCO_DISABLE_INTERNAL_OPENSSL)
|
||||
|
||||
if(POCO_ENABLE_NETSSL OR POCO_ENABLE_CRYPTO OR (POCO_ENABLE_SQL_MYSQL AND MINGW))
|
||||
find_package(OpenSSL REQUIRED)
|
||||
else()
|
||||
find_package(OpenSSL QUIET)
|
||||
endif()
|
||||
|
||||
if(OPENSSL_FOUND)
|
||||
message(STATUS "Found OpenSSL. Enable NetSSL and Crypto support")
|
||||
option(POCO_ENABLE_NETSSL "Enable NetSSL" ON)
|
||||
option(POCO_ENABLE_CRYPTO "Enable Crypto" ON)
|
||||
else()
|
||||
message(STATUS "OpenSSL not found. Disable NetSSL and Crypto support")
|
||||
option(POCO_ENABLE_NETSSL "Enable NetSSL" OFF)
|
||||
option(POCO_ENABLE_CRYPTO "Enable Crypto" OFF)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
option(POCO_ENABLE_NETSSL_WIN "NetSSL Windows" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_NETSSL_WIN "NetSSL Windows" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_APACHECONNECTOR)
|
||||
find_package(APR REQUIRED)
|
||||
find_package(Apache2 REQUIRED)
|
||||
else()
|
||||
find_package(APR QUIET)
|
||||
find_package(Apache2 QUIET)
|
||||
endif()
|
||||
|
||||
if(APRUTIL_FOUND AND APACHE_FOUND)
|
||||
message(STATUS "Found Apache and APR. Enable Apache connector")
|
||||
option(POCO_ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON)
|
||||
else()
|
||||
message(STATUS "Apache and APR not found. Disable Apache connector")
|
||||
option(POCO_ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SQL_MYSQL)
|
||||
find_package(MySQL REQUIRED)
|
||||
else()
|
||||
find_package(MySQL QUIET)
|
||||
endif()
|
||||
|
||||
if(MYSQL_FOUND)
|
||||
option(POCO_ENABLE_SQL "Enable SQL" ON)
|
||||
option(POCO_ENABLE_SQL_MYSQL "Enable SQL MySQL" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_SQL "Enable SQL" OFF)
|
||||
option(POCO_ENABLE_SQL_MYSQL "Enable SQL MySQL" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SQL_POSTGRESQL)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
else()
|
||||
find_package(PostgreSQL QUIET)
|
||||
endif()
|
||||
|
||||
if(POSTGRESQL_FOUND)
|
||||
option(POCO_ENABLE_SQL "Enable SQL" ON)
|
||||
option(POCO_ENABLE_SQL_POSTGRESQL "Enable SQL PosgreSQL" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_SQL "Enable SQL" OFF)
|
||||
option(POCO_ENABLE_SQL_POSTGRESQL "Enable SQL PosgreSQL" OFF)
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SQL_ODBC)
|
||||
find_package(ODBC REQUIRED)
|
||||
else()
|
||||
find_package(ODBC QUIET)
|
||||
endif()
|
||||
|
||||
if(ODBC_FOUND)
|
||||
option(POCO_ENABLE_SQL "Enable SQL" ON)
|
||||
option(POCO_ENABLE_SQL_ODBC "Enable SQL ODBC" ON)
|
||||
else()
|
||||
option(POCO_ENABLE_SQL "Enable SQL" OFF)
|
||||
option(POCO_ENABLE_SQL_ODBC "Enable SQL ODBC" OFF)
|
||||
endif()
|
||||
|
||||
option(POCO_ENABLE_SQL_SQLITE "Enable SQL SQLite" OFF)
|
||||
option(POCO_ENABLE_SEVENZIP "Enable SevenZip" OFF)
|
||||
option(POCO_ENABLE_ZIP "Enable Zip" ON)
|
||||
option(POCO_ENABLE_CPPPARSER "Enable C++ parser" OFF)
|
||||
option(POCO_ENABLE_POCODOC "Enable Poco Documentation Generator" OFF)
|
||||
option(POCO_ENABLE_PAGECOMPILER "Enable PageCompiler" ON)
|
||||
option(POCO_ENABLE_PAGECOMPILER_FILE2PAGE "Enable File2Page" ON)
|
||||
option(POCO_ENABLE_REDIS "Enable Redis" ON)
|
||||
|
||||
option(POCO_ENABLE_TESTS
|
||||
"Set to OFF|ON (default is OFF) to control build of POCO tests" OFF)
|
||||
|
||||
option(POCO_ENABLE_SAMPLES
|
||||
"Set to OFF|ON (default is OFF) to control build of POCO samples" OFF)
|
||||
if(POCO_STATIC)
|
||||
message(DEPRECATION "POCO_STATIC is deprecated and will be removed! Use BUILD_SHARED_LIBS instead")
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building static libraries")
|
||||
endif()
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
else()
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building dynamic libraries")
|
||||
endif()
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
endif()
|
||||
|
||||
option(POCO_UNBUNDLED
|
||||
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
|
||||
@@ -215,25 +216,16 @@ if(MSVC)
|
||||
"Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC" OFF)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building dynamic libraries")
|
||||
endif()
|
||||
else(BUILD_SHARED_LIBS)
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building static libraries")
|
||||
endif()
|
||||
endif(BUILD_SHARED_LIBS)
|
||||
|
||||
if (POCO_ENABLE_TESTS)
|
||||
option(POCO_ENABLE_LONG_RUNNING_TESTS "Enable long running test" ON)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building with tests")
|
||||
endif()
|
||||
if(POCO_ENABLE_TESTS)
|
||||
option(POCO_ENABLE_LONG_RUNNING_TESTS "Enable long running test" ON)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building with tests")
|
||||
endif()
|
||||
elseif (POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building without tests")
|
||||
message(STATUS "Building without tests")
|
||||
endif ()
|
||||
|
||||
if (POCO_ENABLE_SAMPLES)
|
||||
@@ -244,16 +236,18 @@ elseif (POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Building without samples")
|
||||
endif ()
|
||||
|
||||
if (POCO_UNBUNDLED)
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Build with using external sqlite, libz, pcre, expat ...")
|
||||
endif()
|
||||
elseif (POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Build with using internal copy of sqlite, libz, pcre, expat, ...")
|
||||
endif ()
|
||||
if(POCO_UNBUNDLED)
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Build with using external sqlite, libz, pcre, expat ...")
|
||||
endif()
|
||||
elseif(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Build with using internal copy of sqlite, libz, pcre, expat, ...")
|
||||
endif()
|
||||
|
||||
include(DefinePlatformSpecifc)
|
||||
|
||||
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
|
||||
set(Poco_COMPONENTS "")
|
||||
set(POCO_PKG_CONFIG_FILES "")
|
||||
# Pthreads/threads support
|
||||
find_package(Threads REQUIRED)
|
||||
@@ -281,7 +275,6 @@ if(POCO_ENABLE_PAGECOMPILER)
|
||||
set(POCO_ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
if(POCO_ENABLE_MONGODB OR POCO_ENABLE_REDIS)
|
||||
set(POCO_ENABLE_NET ON CACHE BOOL "Enable Net" FORCE)
|
||||
endif()
|
||||
@@ -351,45 +344,56 @@ if(POCO_ENABLE_UTIL AND POCO_ENABLE_SAMPLES)
|
||||
set(POCO_ENABLE_XML ON CACHE BOOL "Enable XML" FORCE)
|
||||
endif()
|
||||
|
||||
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
|
||||
set(Poco_COMPONENTS "")
|
||||
|
||||
if (POCO_ENABLE_TESTS OR POCO_ENABLE_CPPUNIT)
|
||||
add_subdirectory(CppUnit)
|
||||
list(APPEND Poco_COMPONENTS "CppUnit")
|
||||
endif ()
|
||||
|
||||
add_subdirectory(Foundation)
|
||||
|
||||
if(POCO_ENABLE_ENCODINGS)
|
||||
add_subdirectory(Encodings)
|
||||
list(APPEND Poco_COMPONENTS "Encodings")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_XML)
|
||||
add_subdirectory(XML)
|
||||
list(APPEND Poco_COMPONENTS "XML")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_JSON)
|
||||
add_subdirectory(JSON)
|
||||
list(APPEND Poco_COMPONENTS "JSON")
|
||||
endif()
|
||||
if(POCO_ENABLE_MONGODB)
|
||||
add_subdirectory(MongoDB)
|
||||
list(APPEND Poco_COMPONENTS "MongoDB")
|
||||
endif()
|
||||
if(POCO_ENABLE_PDF)
|
||||
add_subdirectory(PDF)
|
||||
list(APPEND Poco_COMPONENTS "PDF")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_UTIL)
|
||||
add_subdirectory(Util)
|
||||
list(APPEND Poco_COMPONENTS "Util")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_NET)
|
||||
add_subdirectory(Net)
|
||||
list(APPEND Poco_COMPONENTS "Net")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_MONGODB)
|
||||
add_subdirectory(MongoDB)
|
||||
list(APPEND Poco_COMPONENTS "MongoDB")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_REDIS)
|
||||
add_subdirectory(Redis)
|
||||
list(APPEND Poco_COMPONENTS "Redis")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_PDF)
|
||||
add_subdirectory(PDF)
|
||||
list(APPEND Poco_COMPONENTS "PDF")
|
||||
endif()
|
||||
|
||||
|
||||
#NetSSL
|
||||
|
||||
|
||||
if(WIN32 AND POCO_ENABLE_NETSSL_WIN)
|
||||
add_subdirectory(NetSSL_Win)
|
||||
list(APPEND Poco_COMPONENTS "NetSSL_Win")
|
||||
@@ -399,13 +403,13 @@ if(OPENSSL_FOUND)
|
||||
if(MSVC)
|
||||
list(APPEND OPENSSL_LIBRARIES ws2_32 Crypt32) # TODO(BJoe) Is this really needed?
|
||||
endif()
|
||||
if(POCO_ENABLE_NETSSL)
|
||||
add_subdirectory(NetSSL_OpenSSL)
|
||||
list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL")
|
||||
endif()
|
||||
if(POCO_ENABLE_CRYPTO)
|
||||
add_subdirectory(Crypto)
|
||||
list(APPEND Poco_COMPONENTS "Crypto")
|
||||
add_subdirectory(Crypto)
|
||||
list(APPEND Poco_COMPONENTS "Crypto")
|
||||
endif()
|
||||
if(POCO_ENABLE_NETSSL)
|
||||
add_subdirectory(NetSSL_OpenSSL)
|
||||
list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL")
|
||||
endif()
|
||||
endif(OPENSSL_FOUND)
|
||||
|
||||
@@ -413,18 +417,16 @@ if(POCO_ENABLE_SQL)
|
||||
add_subdirectory(SQL)
|
||||
list(APPEND Poco_COMPONENTS "SQL")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_SEVENZIP)
|
||||
add_subdirectory(SevenZip)
|
||||
list(APPEND Poco_COMPONENTS "SevenZip")
|
||||
endif()
|
||||
|
||||
if(POCO_ENABLE_ZIP)
|
||||
add_subdirectory(Zip)
|
||||
list(APPEND Poco_COMPONENTS "Zip")
|
||||
endif()
|
||||
if(POCO_ENABLE_REDIS)
|
||||
add_subdirectory(Redis)
|
||||
list(APPEND Poco_COMPONENTS "Redis")
|
||||
endif()
|
||||
|
||||
if(APRUTIL_FOUND AND APACHE_FOUND AND POCO_ENABLE_APACHECONNECTOR)
|
||||
include_directories( "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) # TODO(BJoe) Use namespace target in target_link_libraries()
|
||||
@@ -453,19 +455,20 @@ if(POCO_ENABLE_PAGECOMPILER_FILE2PAGE)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/Encodings/Compiler AND POCO_ENABLE_ENCODINGS_COMPILER)
|
||||
add_subdirectory(Encodings/Compiler)
|
||||
list(APPEND Poco_COMPONENTS "EncodingsCompiler")
|
||||
add_subdirectory(Encodings/Compiler)
|
||||
list(APPEND Poco_COMPONENTS "EncodingsCompiler")
|
||||
endif()
|
||||
|
||||
|
||||
#############################################################
|
||||
# Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
|
||||
#############################################################
|
||||
# Enable packaging
|
||||
@@ -485,9 +488,9 @@ include(CPack)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
# Set config script install location in a location that find_package() will
|
||||
@@ -510,9 +513,6 @@ install(
|
||||
Devel
|
||||
)
|
||||
|
||||
# in tree build settings
|
||||
#configure_file(PocoBuildTreeSettings.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PocoBuildTreeSettings.cmake @ONLY)
|
||||
|
||||
# Install pkg-config files
|
||||
install(FILES ${POCO_PKG_CONFIG_FILES}
|
||||
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
||||
@@ -520,24 +520,12 @@ install(FILES ${POCO_PKG_CONFIG_FILES}
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator")
|
||||
message(STATUS "Installation target path: ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")
|
||||
message(STATUS "Setting Poco build type - ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "")
|
||||
|
||||
message(STATUS "C_FLAGS: =${CMAKE_C_FLAGS}")
|
||||
message(STATUS "CMAKE_C_FLAGS_DEBUG:=${CMAKE_C_FLAGS_DEBUG}")
|
||||
message(STATUS "CMAKE_C_FLAGS_RELEASE:=${CMAKE_C_FLAGS_RELEASE}")
|
||||
message(STATUS "CMAKE_C_FLAGS_MINSIZEREL:=${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||
message(STATUS "CMAKE_C_FLAGS_RELWITHDEBINFO:=${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
message(STATUS "")
|
||||
message(STATUS "")
|
||||
message(STATUS "CXX_FLAGS:=${CMAKE_CXX_FLAGS}")
|
||||
message(STATUS "CMAKE_CXX_FLAGS_DEBUG:=${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
message(STATUS "CMAKE_CXX_FLAGS_RELEASE:=${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL:=${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO:=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
|
||||
message(STATUS "[cmake] build type: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "[cmake] build with cxx flags: ${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${CMAKE_CXX_FLAGS}")
|
||||
message(STATUS "[cmake] build with c flags: ${CMAKE_C_FLAGS_${BUILD_TYPE}} ${CMAKE_C_FLAGS}")
|
||||
|
||||
foreach(component ${Poco_COMPONENTS})
|
||||
message(STATUS "Building: ${component}")
|
||||
|
||||
@@ -20,9 +20,6 @@ if(ANDROID)
|
||||
COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Encodings-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake)
|
||||
else()
|
||||
add_test(NAME Encodings WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Encodings-testrunner -all)
|
||||
# The test is run in the build directory. So the test data is copied there too
|
||||
add_custom_command(TARGET Encodings-testrunner POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data )
|
||||
endif()
|
||||
#set_target_properties(Encodings-testrunner PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
|
||||
target_link_libraries(Encodings-testrunner PUBLIC Poco::Encodings Poco::CppUnit)
|
||||
|
||||
@@ -107,7 +107,13 @@ target_include_directories(Foundation
|
||||
target_compile_definitions(Foundation
|
||||
PUBLIC
|
||||
$<$<CONFIG:Debug>:_DEBUG>
|
||||
$<$<BOOL:${POCO_DISABLE_CPP14}>:POCO_DISABLE_CPP14>
|
||||
$<$<NOT:$<BOOL:${POCO_DISABLE_CPP14}>>:POCO_ENABLE_CPP14>
|
||||
)
|
||||
target_compile_features(Foundation PUBLIC cxx_defaulted_move_initializers)
|
||||
if(NOT DISABLE_CPP14 AND CMAKE_VERSION VERSION_GREATER 3.7)
|
||||
target_compile_features(Foundation PUBLIC cxx_std_14)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(Foundation
|
||||
@@ -117,7 +123,7 @@ if(NOT BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(Foundation PUBLIC UNICODE _UNICODE __LCC__) #__LCC__ define used by MySQL.h
|
||||
target_compile_definitions(Foundation PUBLIC UNICODE _UNICODE)
|
||||
target_link_libraries(Foundation PUBLIC iphlpapi)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ elseif(POCO_VERBOSE_MESSAGES)
|
||||
endif(POCO_ENABLE_SQL_SQLITE)
|
||||
|
||||
if(MYSQL_FOUND AND POCO_ENABLE_SQL_MYSQL)
|
||||
include_directories("${MYSQL_INCLUDE_DIR}") # TODO(Bjoe) Use target_link_libraries()
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "MySQL Support Enabled")
|
||||
endif()
|
||||
@@ -57,7 +56,6 @@ elseif(POCO_VERBOSE_MESSAGES)
|
||||
endif()
|
||||
|
||||
if(POSTGRESQL_FOUND AND POCO_ENABLE_SQL_POSTGRESQL)
|
||||
include_directories("${PostgreSQL_INCLUDE_DIR}") # TODO(Bjoe) Use target_link_libraries()
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "PostgreSQL Support Enabled")
|
||||
endif()
|
||||
@@ -67,14 +65,12 @@ elseif(POCO_VERBOSE_MESSAGES)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT WINCE AND POCO_ENABLE_SQL_ODBC)
|
||||
set(ODBC_LIBRARIES "odbc32" "odbccp32")
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "Windows native ODBC Support Enabled")
|
||||
endif()
|
||||
add_subdirectory( ODBC )
|
||||
else()
|
||||
if(ODBC_FOUND AND POCO_ENABLE_SQL_ODBC)
|
||||
include_directories("${ODBC_INCLUDE_DIRECTORIES}") # TODO(Bjoe) Use target_link_libraries()
|
||||
if(POCO_VERBOSE_MESSAGES)
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
endif()
|
||||
|
||||
@@ -16,7 +16,7 @@ set_target_properties(SQLMySQL
|
||||
DEFINE_SYMBOL MySQL_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(SQLMySQL PUBLIC Poco::SQL ${MYSQL_LIB}) # TODO(Bjoe) Use namespace target
|
||||
target_link_libraries(SQLMySQL PUBLIC Poco::SQL MySQL::client)
|
||||
target_include_directories(SQLMySQL
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
@@ -25,8 +25,11 @@ target_include_directories(SQLMySQL
|
||||
)
|
||||
target_compile_definitions(SQLMySQL PUBLIC THREADSAFE NO_TCL)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(SQLMySQL PUBLIC __LCC__) #__LCC__ define used by MySQL.h
|
||||
endif()
|
||||
if(MINGW) # MinGW supports 'mariadb-connector-c' only with OpenSSL
|
||||
target_link_libraries(SQLMySQL PUBLIC ws2_32 ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(SQLMySQL PUBLIC ws2_32 OpenSSL::SSL)
|
||||
endif()
|
||||
|
||||
POCO_INSTALL(SQLMySQL)
|
||||
|
||||
@@ -16,14 +16,14 @@ set_target_properties(SQLODBC
|
||||
DEFINE_SYMBOL ODBC_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(SQLODBC PUBLIC Poco::SQL ${ODBC_LIBRARIES}) # TODO(Bjoe) Use namespace target
|
||||
target_link_libraries(SQLODBC PUBLIC Poco::SQL ODBC::ODBC)
|
||||
target_include_directories(SQLODBC
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
target_compile_definitions(SQLODBC PUBLIC ${ODBC_CFLAGS} THREADSAFE)
|
||||
target_compile_definitions(SQLODBC PUBLIC THREADSAFE)
|
||||
|
||||
POCO_INSTALL(SQLODBC)
|
||||
POCO_GENERATE_PACKAGE(SQLODBC)
|
||||
|
||||
@@ -15,7 +15,7 @@ set_target_properties(SQLPostgreSQL
|
||||
DEFINE_SYMBOL PostgreSQL_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(SQLPostgreSQL PUBLIC Poco::SQL ${PostgreSQL_LIBRARIES})
|
||||
target_link_libraries(SQLPostgreSQL PUBLIC Poco::SQL PostgreSQL::client)
|
||||
target_include_directories(SQLPostgreSQL
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
||||
24
appveyor.yml
24
appveyor.yml
@@ -421,18 +421,26 @@ build_script:
|
||||
if ($env:platform -eq "Win32")
|
||||
{
|
||||
$openssl = $env:OPENSSL32
|
||||
if ($env:vsver -eq "140")
|
||||
{
|
||||
$generator = '"Visual Studio 14 2015"'
|
||||
}
|
||||
if ($env:vsver -eq "150")
|
||||
{
|
||||
$generator = '"Visual Studio 15 2017"'
|
||||
}
|
||||
}
|
||||
if ($env:platform -eq "x64")
|
||||
{
|
||||
$openssl = $env:OPENSSL64
|
||||
}
|
||||
if ($env:vsver -eq "140")
|
||||
{
|
||||
$generator = '"Visual Studio 14 2015"'
|
||||
}
|
||||
if ($env:vsver -eq "150")
|
||||
{
|
||||
$generator = '"Visual Studio 15 2017"'
|
||||
if ($env:vsver -eq "140")
|
||||
{
|
||||
$generator = '"Visual Studio 14 2015 Win64"'
|
||||
}
|
||||
if ($env:vsver -eq "150")
|
||||
{
|
||||
$generator = '"Visual Studio 15 2017 Win64"'
|
||||
}
|
||||
}
|
||||
$defs = "-H."
|
||||
$defs+=" -Bbuild-cmake"
|
||||
|
||||
@@ -18,44 +18,50 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Determines whether or not the compiler supports C++11
|
||||
# Determines whether the compiler supports C++11
|
||||
macro(check_for_cxx11_compiler _VAR)
|
||||
message(STATUS "Checking for C++11 compiler")
|
||||
set(${_VAR})
|
||||
if((MSVC AND (MSVC10 OR MSVC11 OR MSVC12 OR MSVC14)) OR
|
||||
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.6) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.1) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON)
|
||||
if(NOT _COMPILER_TEST_RESULT AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON)
|
||||
if(_COMPILER_TEST_RESULT)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
else()
|
||||
message(STATUS "To enable C++11 install libc++ standard library from https://libcxx.llvm.org/")
|
||||
endif()
|
||||
endif()
|
||||
if(_COMPILER_TEST_RESULT AND ((MSVC AND (MSVC10 OR MSVC11 OR MSVC12 OR MSVC14)) OR
|
||||
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.1) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.3) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")))
|
||||
set(${_VAR} 1)
|
||||
message(STATUS "Checking for C++11 compiler - available")
|
||||
message(STATUS "Checking for C++11 compiler - available")
|
||||
else()
|
||||
message(STATUS "Checking for C++11 compiler - unavailable")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Sets the appropriate flag to enable C++11 support
|
||||
macro(enable_cxx11)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endmacro()
|
||||
|
||||
# Determines whether or not the compiler supports C++11
|
||||
# Determines whether the compiler supports C++14
|
||||
macro(check_for_cxx14_compiler _VAR)
|
||||
message(STATUS "Checking for C++14 compiler")
|
||||
set(${_VAR})
|
||||
if((MSVC AND (MSVC14)) OR
|
||||
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.7) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.4) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=ON)
|
||||
if(NOT _COMPILER_TEST_RESULT AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=ON)
|
||||
if(_COMPILER_TEST_RESULT)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
else()
|
||||
message(STATUS "To enable C++14 install libc++ standard library from https://libcxx.llvm.org/")
|
||||
endif()
|
||||
endif()
|
||||
if(_COMPILER_TEST_RESULT AND ((MSVC AND (MSVC14)) OR
|
||||
(CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.9.2) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.4) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")))
|
||||
set(${_VAR} 1)
|
||||
message(STATUS "Checking for C++14 compiler - available")
|
||||
else()
|
||||
message(STATUS "Checking for C++14 compiler - unavailable")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Sets the appropriate flag to enable C++14 support
|
||||
macro(enable_cxx14)
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endmacro()
|
||||
|
||||
@@ -49,8 +49,8 @@ else(MSVC)
|
||||
# Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment
|
||||
set(STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE)
|
||||
endif(MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
|
||||
|
||||
|
||||
# Add a d postfix to the debug libraries
|
||||
if(POCO_STATIC)
|
||||
|
||||
@@ -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,35 +1,55 @@
|
||||
# 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
|
||||
${BINDIR32}/MySQL/*/include
|
||||
$ENV{SystemDrive}/MySQL/*/include
|
||||
${MYSQL_INCLUDE_DIR}
|
||||
${MYSQL_DIR}/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
|
||||
${MARIADB_INCLUDE_DIR}
|
||||
${MARIADB_DIR}/include)
|
||||
endif (NOT MYSQL_INCLUDE_DIR)
|
||||
$ENV{MARIADB_INCLUDE_DIR}
|
||||
$ENV{MARIADB_DIR}/include
|
||||
${MARIADB_INCLUDE_DIR}
|
||||
${MARIADB_DIR}/include
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
mariadb
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
@@ -38,68 +58,76 @@ if (MSVC)
|
||||
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.lib
|
||||
PATHS
|
||||
$ENV{MYSQL_DIR}/lib/${libsuffixDist}
|
||||
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
|
||||
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
||||
${BINDIR32}/MySQL/lib
|
||||
${BINDIR32}/MySQL/*/lib
|
||||
${BINDIR32}/MySQL/*/lib/vs12
|
||||
${BINDIR32}/MySQL/*/lib/vs11
|
||||
${BINDIR32}/MySQL/*/lib/vs10
|
||||
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
|
||||
else (MSVC)
|
||||
find_library(MYSQL_LIB NAMES mysqlclient mysqlclient_r
|
||||
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
|
||||
${MYSQL_DIR}/lib)
|
||||
|
||||
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
|
||||
${MARIADB_DIR}/lib)
|
||||
endif (NOT MYSQL_LIB)
|
||||
endif (MSVC)
|
||||
find_library(MYSQL_LIBRARY NAMES mysqlclient
|
||||
HINTS
|
||||
${MYSQL_ROOT_DIR}/lib
|
||||
${MYSQL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_MYSQL_LIBRARY_DIRS}
|
||||
${PC_MARIADB_LIBRARY_DIRS}
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
$ENV{MYSQL_DIR}/libmysql
|
||||
$ENV{MYSQL_DIR}/client
|
||||
$ENV{ProgramFiles}/MySQL/*/lib
|
||||
${BINDIR32}/MySQL/*/lib
|
||||
$ENV{SystemDrive}/MySQL/*/lib
|
||||
PATH_SUFFIXES
|
||||
vs12
|
||||
vs11
|
||||
vs10
|
||||
${libsuffixDist}
|
||||
${libsuffixBuild}
|
||||
)
|
||||
else()
|
||||
find_library(MYSQL_LIBRARY NAMES mysqlclient mysqlclient_r mariadbclient
|
||||
HINTS
|
||||
${MYSQL_ROOT_DIR}/lib
|
||||
${MYSQL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${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
|
||||
${MYSQL_DIR}/lib
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
mariadb
|
||||
)
|
||||
endif()
|
||||
|
||||
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)
|
||||
set(MYSQL_VERSION ${PC_MYSQL_VERSION})
|
||||
|
||||
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,98 +1,147 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindMySQL
|
||||
# -------
|
||||
#
|
||||
# Find the ODBC driver manager includes and library.
|
||||
# Find ODBC Runtime
|
||||
#
|
||||
# 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 will define the following variables::
|
||||
#
|
||||
# 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.
|
||||
# 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)
|
||||
set(ODBC_LIBRARIES_HINTS
|
||||
"C:/Program Files/ODBC/lib"
|
||||
"C:/ODBC/lib/debug"
|
||||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"
|
||||
)
|
||||
if(X64)
|
||||
list(APPEND ODBC_LIBRARIES_HINTS "${kit81_dir}/Lib/winv6.3/um/x64")
|
||||
list(APPEND ODBC_LIBRARIES_HINTS "${kit_dir}/Lib/win8/um/x64")
|
||||
else()
|
||||
list(APPEND ODBC_LIBRARIES_HINTS "${kit81_dir}/Lib/winv6.3/um/x86")
|
||||
list(APPEND ODBC_LIBRARIES_HINTS "${kit_dir}/Lib/win8/um/x86")
|
||||
endif()
|
||||
find_library(ODBC_LIBRARIES
|
||||
NAMES odbc32
|
||||
HINTS
|
||||
${ODBC_LIBRARIES_HINTS}
|
||||
DOC "Specify the ODBC driver manager library here."
|
||||
)
|
||||
set(ODBC_INCLUDE_DIRECTORIES_HINTS
|
||||
endif()
|
||||
|
||||
find_path(ODBC_INCLUDE_DIR
|
||||
NAMES sql.h
|
||||
HINTS
|
||||
${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"
|
||||
)
|
||||
if(ODBC_LIBRARIES)
|
||||
string(FIND ${ODBC_LIBRARIES} ${kit_dir} kit_found)
|
||||
if(${kit_found} EQUAL 0)
|
||||
list(APPEND ODBC_INCLUDE_DIRECTORIES_HINTS "${kit_dir}/Include/um")
|
||||
endif()
|
||||
string(FIND ${ODBC_LIBRARIES} ${kit81_dir} kit81_found)
|
||||
if(${kit81_found} EQUAL 0)
|
||||
list(APPEND ODBC_INCLUDE_DIRECTORIES_HINTS "${kit81_dir}/Include/um")
|
||||
endif()
|
||||
endif()
|
||||
find_path(ODBC_INCLUDE_DIRECTORIES
|
||||
NAMES sql.h
|
||||
HINTS
|
||||
${ODBC_INCLUDE_DIRECTORIES_HINTS}
|
||||
DOC "Specify the directory containing sql.h."
|
||||
)
|
||||
elseif(MINGW)
|
||||
set(ODBC_INCLUDE_DIRECTORIES ".")
|
||||
set(ODBC_LIBRARIES odbc32)
|
||||
"${kit_dir}/Include/um"
|
||||
"${kit81_dir}/Include/um"
|
||||
PATH_SUFFIXES
|
||||
odbc
|
||||
iodbc
|
||||
DOC "Specify the directory containing sql.h."
|
||||
)
|
||||
|
||||
if(NOT ODBC_INCLUDE_DIR AND WIN32)
|
||||
set(ODBC_INCLUDE_DIR "")
|
||||
else()
|
||||
find_path(ODBC_INCLUDE_DIRECTORIES
|
||||
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
|
||||
DOC "Specify the directory containing sql.h."
|
||||
)
|
||||
find_library(ODBC_LIBRARIES
|
||||
NAMES iodbc odbc iodbcinst odbcinst odbc32
|
||||
HINTS
|
||||
set(REQUIRED_INCLUDE_DIR ODBC_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WIN_ARCH x64)
|
||||
elseif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(WIN_ARCH x86)
|
||||
endif()
|
||||
|
||||
find_library(ODBC_LIBRARY
|
||||
NAMES unixodbc iodbc odbc odbc32
|
||||
HINTS
|
||||
${ODBC_ROOT_DIR}/lib
|
||||
${ODBC_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_ODBC_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/lib/odbc
|
||||
/usr/lib/iodbc
|
||||
/usr/local/lib
|
||||
/usr/local/lib/odbc
|
||||
/usr/local/lib/iodbc
|
||||
/usr/local/odbc/lib
|
||||
/usr/local/iodbc/lib
|
||||
DOC "Specify the ODBC driver manager library here."
|
||||
)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ODBC
|
||||
DEFAULT_MSG
|
||||
ODBC_INCLUDE_DIRECTORIES
|
||||
ODBC_LIBRARIES
|
||||
)
|
||||
"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"
|
||||
"${kit_dir}/Lib/win8/um"
|
||||
PATH_SUFIXES
|
||||
odbc
|
||||
${WIN_ARCH}
|
||||
DOC "Specify the ODBC driver manager library here."
|
||||
)
|
||||
|
||||
mark_as_advanced(ODBC_FOUND ODBC_LIBRARIES ODBC_INCLUDE_DIRECTORIES)
|
||||
if(NOT ODBC_LIBRARY AND WIN32)
|
||||
# List names of ODBC libraries on Windows
|
||||
set(ODBC_LIBRARY odbc32.lib)
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
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
|
||||
/usr/local/iodbc/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)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# - Find pcre
|
||||
# Find the native PCRE includes and library
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
9
cmake/test_compiler.cpp
Normal file
9
cmake/test_compiler.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string str = "Try to compile";
|
||||
std::cout << str << '\n';
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user