2020-01-10 17:08:59 +01:00
cmake_minimum_required ( VERSION 3.5.0 )
2012-06-26 14:40:26 +02:00
2015-09-26 11:11:23 +02:00
project ( Poco )
file ( STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION )
2014-06-24 12:23:50 +02:00
# Read the version information from the VERSION file
2020-02-14 11:07:32 +01:00
file ( STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION )
2015-02-04 04:46:25 +01:00
string ( REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${ PACKAGE_VERSION } )
2020-02-13 20:25:29 +01:00
string ( REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MINOR ${ PACKAGE_VERSION } )
2015-02-04 04:46:25 +01:00
string ( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH ${ PACKAGE_VERSION } )
2014-06-24 12:23:50 +02:00
2018-06-03 18:17:50 +02:00
set ( PROJECT_VERSION ${ CPACK_PACKAGE_VERSION_MAJOR } . ${ CPACK_PACKAGE_VERSION_MINOR } . ${ CPACK_PACKAGE_VERSION_PATCH } )
2014-07-09 15:34:50 +02:00
set ( RELEASE_NAME "Unstable-trunk" )
2018-06-03 18:17:50 +02:00
2012-06-26 14:40:26 +02:00
# Put the libaries and binaries that get built into directories at the
# 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 )
2014-07-11 20:44:49 +02:00
# Windows DLLs are "runtime" for CMake. Output them to "bin" like the Visual Studio projects do.
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ CMAKE_BINARY_DIR } /bin )
2012-06-26 14:40:26 +02:00
2012-12-16 03:40:40 +01:00
# Append our module directory to CMake
2018-06-03 18:17:50 +02:00
list ( APPEND CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /cmake )
2015-09-26 11:11:23 +02:00
2019-04-22 23:47:11 +02:00
if ( CMAKE_VERSION VERSION_LESS "3.10" )
list ( APPEND CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/V39 )
endif ( )
if ( CMAKE_VERSION VERSION_LESS "3.14" )
list ( APPEND CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/V313 )
endif ( )
2012-06-26 14:40:26 +02:00
#################################################################################
# Setup C/C++ compiler options
#################################################################################
2017-10-24 20:52:12 +02:00
2020-01-10 13:44:51 +01:00
# C++11/14 compiler flags
include ( CXX1x )
check_for_cxx14_compiler ( CXX14_COMPILER )
2017-10-24 20:52:12 +02:00
2020-01-10 13:44:51 +01:00
# If a C++14 compiler is available, then set the appropriate flags
if ( CXX14_COMPILER )
2020-02-14 11:07:32 +01:00
set ( CMAKE_CXX_STANDARD 14 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
2020-01-10 13:44:51 +01:00
else ( )
2020-02-14 11:07:32 +01:00
message ( FATAL_ERROR "Compiler does not support C++14." )
2017-10-24 20:52:12 +02:00
endif ( )
2018-06-03 18:17:50 +02:00
if ( NOT CMAKE_BUILD_TYPE )
2020-02-14 11:07:32 +01:00
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
2015-09-26 11:11:23 +02:00
endif ( )
2012-06-26 14:40:26 +02:00
2014-08-22 17:01:09 +02:00
# Include some common macros to simpilfy the Poco CMake files
include ( PocoMacros )
2020-02-13 20:07:47 +01:00
if ( POCO_STATIC )
2021-06-15 15:07:29 +02:00
message ( WARNING "POCO_STATIC has been deprecated. Please use BUILD_SHARED_LIBS=NO to build static libraries." )
2020-02-14 11:07:32 +01:00
option ( BUILD_SHARED_LIBS "Build shared libraries" OFF )
2020-02-13 20:07:47 +01:00
else ( )
2020-02-14 11:07:32 +01:00
option ( BUILD_SHARED_LIBS "Build shared libraries" ON )
2020-02-13 20:07:47 +01:00
endif ( )
2019-09-02 11:48:01 +02:00
if ( MSVC )
2020-02-14 11:07:32 +01:00
option ( POCO_MT "Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD" OFF )
2020-02-13 20:07:47 +01:00
2020-02-14 11:07:32 +01:00
if ( BUILD_SHARED_LIBS AND POCO_MT )
message ( FATAL_ERROR "Cannot have both BUILD_SHARED_LIBS and POCO_MT" )
endif ( )
2019-09-02 11:48:01 +02:00
2020-02-14 11:07:32 +01:00
# allow disabling of internally built OpenSSL# (see below for details)
# if POCO pre-built OpenSSL directory is found, and POCO_DISABLE_INTERNAL_OPENSSL=OFF,
# the internal OpenSSL build will be used
option ( POCO_DISABLE_INTERNAL_OPENSSL "Disable internal OpensSSL binaries use" ON )
2019-09-02 11:48:01 +02:00
2020-02-14 11:07:32 +01:00
if ( ( NOT POCO_DISABLE_INTERNAL_OPENSSL ) AND ( ENABLE_NETSSL OR ENABLE_CRYPTO OR ( ENABLE_DATA_MYSQL AND MINGW ) ) )
include ( UseEmbeddedOpenSSL )
endif ( )
2019-09-02 11:48:01 +02:00
endif ( )
option ( ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF )
option ( FORCE_OPENSSL "Force usage of OpenSSL even under windows" OFF )
2019-07-31 19:33:20 +02:00
if ( ENABLE_CRYPTO OR ENABLE_NETSSL OR ENABLE_JWT )
2018-06-03 18:17:50 +02:00
find_package ( OpenSSL REQUIRED )
else ( )
find_package ( OpenSSL )
endif ( )
if ( OPENSSL_FOUND )
option ( ENABLE_NETSSL "Enable NetSSL" ON )
option ( ENABLE_CRYPTO "Enable Crypto" ON )
2019-07-31 19:33:20 +02:00
option ( ENABLE_JWT "Enable JWT" ON )
2018-06-03 18:17:50 +02:00
else ( )
option ( ENABLE_NETSSL "Enable NetSSL" OFF )
option ( ENABLE_CRYPTO "Enable Crypto" OFF )
2019-07-31 19:33:20 +02:00
option ( ENABLE_JWT "Enable JWT" OFF )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_APACHECONNECTOR )
2020-02-14 11:07:32 +01:00
find_package ( APR REQUIRED )
2018-10-10 13:43:34 +02:00
find_package ( APRUTIL REQUIRED )
find_package ( Apache2 REQUIRED )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
find_package ( APR )
2018-10-10 13:43:34 +02:00
find_package ( APRUTIL )
find_package ( Apache2 )
2018-06-03 18:17:50 +02:00
endif ( )
2018-10-10 13:43:34 +02:00
if ( APR_FOUND AND APRUTIL_FOUND AND APACHE2_FOUND AND
2020-02-14 11:07:32 +01:00
E X I S T S $ { P R O J E C T _ S O U R C E _ D I R } / A p a c h e C o n n e c t o r A N D E N A B L E _ A P A C H E C O N N E C T O R )
option ( ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
option ( ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_DATA_MYSQL )
2020-02-14 11:07:32 +01:00
find_package ( MySQL REQUIRED )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
find_package ( MySQL )
2018-06-03 18:17:50 +02:00
endif ( )
if ( MYSQL_FOUND )
2020-02-14 11:07:32 +01:00
option ( ENABLE_DATA "Enable Data" ON )
option ( ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" ON )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
option ( ENABLE_DATA "Enable Data" OFF )
option ( ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" OFF )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_DATA_POSTGRESQL )
2020-02-14 11:07:32 +01:00
find_package ( PostgreSQL REQUIRED )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
find_package ( PostgreSQL )
2018-06-03 18:17:50 +02:00
endif ( )
2019-07-30 11:19:49 +02:00
2018-10-10 13:43:34 +02:00
if ( PostgreSQL_FOUND )
2021-06-18 12:42:15 +02:00
option ( ENABLE_DATA "Enable Data" ON )
option ( ENABLE_DATA_POSTGRESQL "Enable Data PosgreSQL" ON )
2018-06-03 18:17:50 +02:00
else ( )
2021-06-18 12:42:15 +02:00
option ( ENABLE_DATA "Enable Data" OFF )
option ( ENABLE_DATA_POSTGRESQL "Enable Data PosgreSQL" OFF )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_DATA_ODBC )
2020-02-14 11:07:32 +01:00
find_package ( ODBC REQUIRED )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
find_package ( ODBC )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ODBC_FOUND )
2020-02-14 11:07:32 +01:00
option ( ENABLE_DATA "Enable Data" ON )
option ( ENABLE_DATA_ODBC "Enable Data ODBC" ON )
2018-06-03 18:17:50 +02:00
else ( )
2020-02-14 11:07:32 +01:00
option ( ENABLE_DATA "Enable Data" OFF )
option ( ENABLE_DATA_ODBC "Enable Data ODBC" OFF )
2018-06-03 18:17:50 +02:00
endif ( )
2014-08-22 17:01:09 +02:00
# Allow enabling and disabling components
2019-10-21 10:27:47 +02:00
option ( ENABLE_FOUNDATION "Enable Foundation, required by all components except CppUnit" ON )
2018-02-14 10:25:27 +01:00
option ( ENABLE_ENCODINGS "Enable Encodings" ON )
2018-02-14 12:11:37 +01:00
option ( ENABLE_ENCODINGS_COMPILER "Enable Encodings Compiler" OFF )
2018-02-14 10:25:27 +01:00
option ( ENABLE_XML "Enable XML" ON )
option ( ENABLE_JSON "Enable JSON" ON )
2014-08-22 17:01:09 +02:00
option ( ENABLE_MONGODB "Enable MongoDB" ON )
2018-06-03 18:17:50 +02:00
option ( ENABLE_DATA_SQLITE "Enable Data SQlite" ON )
2017-11-10 12:25:53 +01:00
option ( ENABLE_REDIS "Enable Redis" ON )
2014-12-22 00:06:53 +01:00
option ( ENABLE_PDF "Enable PDF" OFF )
2014-08-22 17:01:09 +02:00
option ( ENABLE_UTIL "Enable Util" ON )
option ( ENABLE_NET "Enable Net" ON )
2019-09-02 11:48:01 +02:00
2014-12-22 00:06:53 +01:00
option ( ENABLE_SEVENZIP "Enable SevenZip" OFF )
2014-08-22 17:01:09 +02:00
option ( ENABLE_ZIP "Enable Zip" ON )
2014-12-22 00:06:53 +01:00
option ( ENABLE_CPPPARSER "Enable C++ parser" OFF )
option ( ENABLE_POCODOC "Enable Poco Documentation Generator" OFF )
2014-12-21 21:54:02 +01:00
option ( ENABLE_PAGECOMPILER "Enable PageCompiler" ON )
option ( ENABLE_PAGECOMPILER_FILE2PAGE "Enable File2Page" ON )
2014-08-22 17:01:09 +02:00
2021-06-18 12:42:15 +02:00
option ( ENABLE_ACTIVERECORD "Enable ActiveRecord" ON )
option ( ENABLE_ACTIVERECORD_COMPILER "Enable ActiveRecord Compiler" ON )
if ( ENABLE_ACTIVERECORD AND NOT ENABLE_DATA )
set ( ENABLE_DATA ON CACHE BOOL "Enable Data" FORCE )
2021-06-18 08:51:42 +02:00
endif ( )
2012-06-26 14:40:26 +02:00
option ( ENABLE_TESTS
2020-02-14 11:07:32 +01:00
" S e t t o O F F | ON ( default is OFF ) t o c o n t r o l b u i l d o f P O C O t e s t s & s a m p l e s " O F F )
2012-06-26 14:40:26 +02:00
option ( POCO_UNBUNDLED
2020-02-14 11:07:32 +01:00
" S e t t o O F F | ON ( default is OFF ) t o c o n t r o l l i n k i n g d e p e n d e n c i e s a s e x t e r n a l " O F F )
2012-06-26 14:40:26 +02:00
2016-12-31 13:14:18 +01:00
if ( ENABLE_TESTS )
2020-02-14 11:07:32 +01:00
include ( CTest )
enable_testing ( )
message ( STATUS "Building with unittests & samples" )
2016-12-31 13:14:18 +01:00
else ( )
2020-02-14 11:07:32 +01:00
message ( STATUS "Building without tests & samples" )
2016-12-31 13:14:18 +01:00
endif ( )
2012-06-26 14:40:26 +02:00
2016-12-31 13:14:18 +01:00
if ( POCO_UNBUNDLED )
2020-02-14 11:07:32 +01:00
message ( STATUS "Using external sqlite, zlib, pcre, expat, ..." )
2016-12-31 13:14:18 +01:00
else ( )
2020-02-14 11:07:32 +01:00
message ( STATUS "Using internal sqlite, zlib, pcre, expat, ..." )
2016-12-31 13:14:18 +01:00
endif ( )
2012-06-26 14:40:26 +02:00
2021-11-05 13:00:08 +01:00
# Disable fork exec
option ( POCO_NO_FORK_EXEC "Set to OFF|ON (default is OFF) to disable use of fork() and exec*() which are not allowed on some Apple platforms (iOS, watchOS, iPadOS, tvOS)." OFF )
if ( POCO_NO_FORK_EXEC )
add_definitions ( -DPOCO_NO_FORK_EXEC=1 )
endif ( )
2015-09-26 11:11:23 +02:00
include ( DefinePlatformSpecifc )
2014-10-09 13:42:51 +02:00
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
set ( Poco_COMPONENTS "" )
2013-11-01 16:46:20 +01:00
2016-12-31 13:14:18 +01:00
if ( ENABLE_TESTS )
2020-02-14 11:07:32 +01:00
add_subdirectory ( CppUnit )
set ( ENABLE_XML ON CACHE BOOL "Enable XML" FORCE )
set ( ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_ENCODINGS_COMPILER OR ENABLE_APACHECONNECTOR )
2020-02-14 11:07:32 +01:00
set ( ENABLE_NET ON CACHE BOOL "Enable Net" FORCE )
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_PAGECOMPILER_FILE2PAGE )
2020-02-14 11:07:32 +01:00
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_PAGECOMPILER )
2020-02-14 11:07:32 +01:00
set ( ENABLE_NET ON CACHE BOOL "Enable Net" FORCE )
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_MONGODB OR ENABLE_REDIS )
2020-02-14 11:07:32 +01:00
set ( ENABLE_NET ON CACHE BOOL "Enable Net" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_DATA_SQLITE OR ENABLE_DATA_MYSQL OR ENABLE_DATA_ODBC OR ENABLE_DATA_POSTGRESQL )
2020-02-14 11:07:32 +01:00
set ( ENABLE_DATA ON CACHE BOOL "Enable Data" FORCE )
if ( ENABLE_TESTS )
set ( ENABLE_NET ON CACHE BOOL "Enable Net" FORCE )
set ( ENABLE_DATA_SQLITE ON CACHE BOOL "Enable Data SQlite" FORCE )
endif ( )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_DATA AND ENABLE_TESTS )
2020-02-14 11:07:32 +01:00
set ( ENABLE_DATA_SQLITE ON CACHE BOOL "Enable Data SQlite" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
2021-06-18 12:42:15 +02:00
if ( ENABLE_ACTIVERECORD AND ENABLE_TESTS )
set ( ENABLE_DATA_SQLITE ON CACHE BOOL "Enable Data SQlite" FORCE )
endif ( )
2021-06-26 11:46:57 +02:00
2018-06-03 18:17:50 +02:00
if ( ENABLE_NETSSL_WIN )
2020-02-14 11:07:32 +01:00
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
if ( ENABLE_TESTS )
set ( ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE )
endif ( )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_NETSSL )
set ( ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE )
2020-02-14 11:07:32 +01:00
set ( ENABLE_NET ON CACHE BOOL "Enable Net" FORCE )
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_CRYPTO AND ENABLE_TESTS )
2020-02-14 11:07:32 +01:00
set ( ENABLE_NETSSL ON CACHE BOOL "Enable NetSSL" FORCE )
set ( ENABLE_NET ON CACHE BOOL "Enable Net" FORCE )
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_NET AND ENABLE_TESTS )
2020-02-14 11:07:32 +01:00
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_PDF )
2020-02-14 11:07:32 +01:00
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
set ( ENABLE_XML ON CACHE BOOL "Enable XML" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_POCODOC )
2020-02-14 11:07:32 +01:00
set ( ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE )
set ( ENABLE_XML ON CACHE BOOL "Enable XML" FORCE )
set ( ENABLE_CPPPARSER ON CACHE BOOL "Enable C++ parser" FORCE )
2018-06-03 18:17:50 +02:00
endif ( )
if ( ENABLE_UTIL AND ENABLE_TESTS )
2020-02-14 11:07:32 +01:00
set ( ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE )
set ( ENABLE_XML ON CACHE BOOL "Enable XML" FORCE )
2016-12-31 13:14:18 +01:00
endif ( )
2012-06-26 14:40:26 +02:00
2019-09-02 11:48:01 +02:00
if ( ENABLE_JWT )
set ( ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE )
2020-02-14 11:07:32 +01:00
set ( ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE )
2019-09-02 11:48:01 +02:00
endif ( )
2019-10-18 15:35:02 +02:00
if ( ENABLE_FOUNDATION )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Foundation )
2019-10-18 15:35:02 +02:00
endif ( )
2021-06-26 11:46:57 +02:00
2018-02-14 10:25:27 +01:00
if ( ENABLE_ENCODINGS )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Encodings )
list ( APPEND Poco_COMPONENTS "Encodings" )
2018-02-14 10:25:27 +01:00
endif ( )
2018-06-03 18:17:50 +02:00
2014-08-22 17:01:09 +02:00
if ( ENABLE_XML )
2020-02-14 11:07:32 +01:00
add_subdirectory ( XML )
list ( APPEND Poco_COMPONENTS "XML" )
2014-08-22 17:01:09 +02:00
endif ( )
2018-06-03 18:17:50 +02:00
2014-08-22 17:01:09 +02:00
if ( ENABLE_JSON )
2020-02-14 11:07:32 +01:00
add_subdirectory ( JSON )
list ( APPEND Poco_COMPONENTS "JSON" )
2014-08-22 17:01:09 +02:00
endif ( )
2018-06-03 18:17:50 +02:00
2017-11-10 19:21:55 +01:00
if ( ENABLE_UTIL )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Util )
list ( APPEND Poco_COMPONENTS "Util" )
2017-11-10 19:21:55 +01:00
endif ( )
2018-06-03 18:17:50 +02:00
2017-11-10 19:21:55 +01:00
if ( ENABLE_NET )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Net )
list ( APPEND Poco_COMPONENTS "Net" )
2017-11-10 19:21:55 +01:00
endif ( )
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /MongoDB AND ENABLE_MONGODB )
2020-02-14 11:07:32 +01:00
add_subdirectory ( MongoDB )
list ( APPEND Poco_COMPONENTS "MongoDB" )
2014-08-22 17:01:09 +02:00
endif ( )
2018-06-03 18:17:50 +02:00
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /Redis AND ENABLE_REDIS )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Redis )
list ( APPEND Poco_COMPONENTS "Redis" )
2017-11-10 12:25:53 +01:00
endif ( )
2018-06-03 18:17:50 +02:00
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /PDF AND ENABLE_PDF )
2020-02-14 11:07:32 +01:00
add_subdirectory ( PDF )
list ( APPEND Poco_COMPONENTS "PDF" )
2014-08-22 17:01:09 +02:00
endif ( )
2012-06-26 14:40:26 +02:00
2019-09-02 11:48:01 +02:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /JWT AND ENABLE_JWT )
2020-02-14 11:07:32 +01:00
add_subdirectory ( JWT )
list ( APPEND Poco_COMPONENTS "JWT" )
2019-09-02 11:48:01 +02:00
endif ( )
2014-10-09 13:42:51 +02:00
#NetSSL
2017-11-10 21:35:25 +01:00
if ( WIN32 AND EXISTS ${ PROJECT_SOURCE_DIR } /NetSSL_Win AND ENABLE_NETSSL_WIN )
2020-02-14 11:07:32 +01:00
add_subdirectory ( NetSSL_Win )
list ( APPEND Poco_COMPONENTS "NetSSL_Win" )
2017-11-10 21:35:25 +01:00
endif ( WIN32 AND EXISTS ${ PROJECT_SOURCE_DIR } /NetSSL_Win AND ENABLE_NETSSL_WIN )
2014-10-09 13:42:51 +02:00
2012-06-26 14:40:26 +02:00
if ( OPENSSL_FOUND )
2020-02-14 11:07:32 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /NetSSL_OpenSSL AND ENABLE_NETSSL )
add_subdirectory ( NetSSL_OpenSSL )
list ( APPEND Poco_COMPONENTS "NetSSL_OpenSSL" )
endif ( )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /Crypto AND ENABLE_CRYPTO )
add_subdirectory ( Crypto )
list ( APPEND Poco_COMPONENTS "Crypto" )
endif ( )
2012-06-26 14:40:26 +02:00
endif ( OPENSSL_FOUND )
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /Data AND ENABLE_DATA )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Data )
list ( APPEND Poco_COMPONENTS "Data" )
2014-08-22 17:01:09 +02:00
endif ( )
2018-06-03 18:17:50 +02:00
2021-06-18 12:42:15 +02:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /ActiveRecord AND ENABLE_ACTIVERECORD )
add_subdirectory ( ActiveRecord )
list ( APPEND Poco_COMPONENTS "ActiveRecord" )
endif ( )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /ActiveRecord/Compiler AND ENABLE_ACTIVERECORD_COMPILER )
add_subdirectory ( ActiveRecord/Compiler )
list ( APPEND Poco_COMPONENTS "ActiveRecordCompiler" )
endif ( )
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /SevenZip AND ENABLE_SEVENZIP )
2020-02-14 11:07:32 +01:00
add_subdirectory ( SevenZip )
list ( APPEND Poco_COMPONENTS "SevenZip" )
2014-08-22 17:01:09 +02:00
endif ( )
2018-06-03 18:17:50 +02:00
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /Zip AND ENABLE_ZIP )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Zip )
list ( APPEND Poco_COMPONENTS "Zip" )
2014-08-22 17:01:09 +02:00
endif ( )
2012-06-26 14:40:26 +02:00
2019-07-30 11:19:49 +02:00
if ( APRUTIL_FOUND AND APACHE_FOUND AND
2020-02-14 11:07:32 +01:00
E X I S T S $ { P R O J E C T _ S O U R C E _ D I R } / A p a c h e C o n n e c t o r A N D E N A B L E _ A P A C H E C O N N E C T O R )
add_subdirectory ( ApacheConnector )
list ( APPEND Poco_COMPONENTS "ApacheConnector" )
2018-06-03 18:17:50 +02:00
endif ( )
2012-06-26 14:40:26 +02:00
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /CppParser AND ENABLE_CPPPARSER )
2020-02-14 11:07:32 +01:00
add_subdirectory ( CppParser )
list ( APPEND Poco_COMPONENTS "CppParser" )
2014-12-11 10:17:08 +01:00
endif ( )
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /PocoDoc AND ENABLE_POCODOC )
2020-02-14 11:07:32 +01:00
add_subdirectory ( PocoDoc )
list ( APPEND Poco_COMPONENTS "PocoDoc" )
2014-12-11 10:31:13 +01:00
endif ( )
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /PageCompiler AND ENABLE_PAGECOMPILER )
2020-02-14 11:07:32 +01:00
add_subdirectory ( PageCompiler )
list ( APPEND Poco_COMPONENTS "PageCompiler" )
2014-12-21 21:54:02 +01:00
endif ( )
2017-11-10 21:35:25 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /PageCompiler/File2Page AND ENABLE_PAGECOMPILER_FILE2PAGE )
2020-02-14 11:07:32 +01:00
add_subdirectory ( PageCompiler/File2Page )
list ( APPEND Poco_COMPONENTS "File2Page" )
2014-12-21 21:54:02 +01:00
endif ( )
2018-02-14 12:11:37 +01:00
if ( EXISTS ${ PROJECT_SOURCE_DIR } /Encodings/Compiler AND ENABLE_ENCODINGS_COMPILER )
2020-02-14 11:07:32 +01:00
add_subdirectory ( Encodings/Compiler )
list ( APPEND Poco_COMPONENTS "EncodingsCompiler" )
2018-02-14 12:11:37 +01:00
endif ( )
2017-11-10 19:21:55 +01:00
2012-06-26 14:40:26 +02:00
#############################################################
# Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ
2014-07-09 15:34:50 +02:00
configure_file (
2020-02-14 11:07:32 +01:00
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
2012-06-26 14:40:26 +02:00
2014-07-09 15:34:50 +02:00
add_custom_target ( uninstall
2020-02-14 11:07:32 +01:00
" $ { C M A K E _ C O M M A N D } " - P " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
)
2012-06-26 14:40:26 +02:00
#############################################################
# Enable packaging
2014-07-09 15:34:50 +02:00
include ( InstallRequiredSystemLibraries )
2012-06-26 14:40:26 +02:00
2014-07-09 15:34:50 +02:00
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Poco Libraries" )
set ( CPACK_PACKAGE_VENDOR "Applied Informatics Software Engineering GmbH" )
set ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README" )
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" )
set ( CPACK_PACKAGE_INSTALL_DIRECTORY "/usr/local" )
2012-06-26 14:40:26 +02:00
2014-07-09 15:34:50 +02:00
include ( CPack )
2012-06-26 14:40:26 +02:00
2014-10-09 13:42:51 +02:00
#############################################################
2017-11-10 12:25:53 +01:00
# cmake config files
2014-10-09 13:42:51 +02:00
include ( CMakePackageConfigHelpers )
write_basic_package_version_file (
2020-02-14 11:07:32 +01:00
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { P R O J E C T _ N A M E } / $ { P R O J E C T _ N A M E } C o n f i g V e r s i o n . c m a k e "
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y A n y N e w e r V e r s i o n
2014-10-09 13:42:51 +02:00
)
2020-02-05 06:41:10 +01:00
# Set config script install location in a location that find_package() will
# look for, which is different on MS Windows than for UNIX
# Note: also set in POCO_GENERATE_PACKAGE macro in cmake/PocoMacros.cmake
2020-02-14 11:07:32 +01:00
if ( WIN32 )
set ( PocoConfigPackageLocation "cmake" )
2020-02-05 06:41:10 +01:00
else ( )
2020-02-14 11:07:32 +01:00
set ( PocoConfigPackageLocation "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}" )
2020-02-05 06:41:10 +01:00
endif ( )
2014-10-09 13:42:51 +02:00
configure_file ( cmake/ ${ PROJECT_NAME } Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" @ONLY )
install (
2020-02-14 11:07:32 +01:00
F I L E S
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { P R O J E C T _ N A M E } / $ { P R O J E C T _ N A M E } C o n f i g . c m a k e
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { P R O J E C T _ N A M E } / $ { P R O J E C T _ N A M E } C o n f i g V e r s i o n . c m a k e
D E S T I N A T I O N
2020-02-16 15:39:44 +01:00
" $ { P o c o C o n f i g P a c k a g e L o c a t i o n } "
2020-02-14 11:07:32 +01:00
C O M P O N E N T
D e v e l
2014-10-09 13:42:51 +02:00
)
2019-04-22 23:47:11 +02:00
if ( POCO_UNBUNDLED )
2020-02-14 11:07:32 +01:00
install ( FILES cmake/FindPCRE.cmake
D E S T I N A T I O N " $ { P o c o C o n f i g P a c k a g e L o c a t i o n } " )
install ( FILES cmake/V39/FindEXPAT.cmake
D E S T I N A T I O N " $ { P o c o C o n f i g P a c k a g e L o c a t i o n } / V 3 9 " )
install ( FILES cmake/V313/FindSQLite3.cmake
D E S T I N A T I O N " $ { P o c o C o n f i g P a c k a g e L o c a t i o n } / V 3 1 3 " )
2019-04-22 23:47:11 +02:00
endif ( )
2012-06-26 14:40:26 +02:00
message ( STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator" )
2018-10-10 13:48:08 +02:00
message ( STATUS "${PROJECT_NAME} package version: ${PROJECT_VERSION}" )
if ( BUILD_SHARED_LIBS )
message ( STATUS "Building dynamic libraries" )
else ( )
message ( STATUS "Building static libraries" )
endif ( )
message ( STATUS "[cmake] Installation target path: ${CMAKE_INSTALL_PREFIX}" )
if ( CMAKE_TOOLCHAIN_FILE )
2020-02-14 11:07:32 +01:00
message ( STATUS "[cmake] Use toolchain file: ${CMAKE_TOOLCHAIN_FILE}" )
2018-10-10 13:48:08 +02:00
endif ( )
2021-06-27 06:49:34 +02:00
message ( STATUS "[cmake] Build for OS type: ${CMAKE_SYSTEM_NAME}" )
message ( STATUS "[cmake] Build for OS version: ${CMAKE_SYSTEM_VERSION}" )
message ( STATUS "[cmake] Build for CPU type: ${CMAKE_SYSTEM_PROCESSOR}" )
message ( STATUS "[cmake] Build type: ${CMAKE_BUILD_TYPE}" )
2018-09-22 12:02:05 +02:00
string ( TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE )
2021-06-27 06:49:34 +02:00
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}" )
2012-06-26 14:40:26 +02:00
2014-10-09 13:42:51 +02:00
foreach ( component ${ Poco_COMPONENTS } )
2020-02-14 11:07:32 +01:00
message ( STATUS "Building: ${component}" )
2014-10-09 13:42:51 +02:00
endforeach ( )