diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d8af173b..a5a2ee907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required(VERSION 3.5.0) -cmake_policy(VERSION 3.15.0) +cmake_minimum_required(VERSION 3.15.0) project(Poco) @@ -33,12 +32,6 @@ endforeach(OUTPUTCONFIG) # Append our module directory to CMake list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -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() ################################################################################# # Setup C/C++ compiler options ################################################################################# @@ -562,10 +555,6 @@ install( if(POCO_UNBUNDLED) install(FILES cmake/FindPCRE2.cmake DESTINATION "${PocoConfigPackageLocation}") - install(FILES cmake/V39/FindEXPAT.cmake - DESTINATION "${PocoConfigPackageLocation}/V39") - install(FILES cmake/V313/FindSQLite3.cmake - DESTINATION "${PocoConfigPackageLocation}/V313") endif() message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator") diff --git a/Data/PostgreSQL/CMakeLists.txt b/Data/PostgreSQL/CMakeLists.txt index fcd6a2c4d..57c70b74d 100644 --- a/Data/PostgreSQL/CMakeLists.txt +++ b/Data/PostgreSQL/CMakeLists.txt @@ -21,7 +21,7 @@ set_target_properties(DataPostgreSQL DEFINE_SYMBOL PostgreSQL_EXPORTS ) -target_link_libraries(DataPostgreSQL PUBLIC Poco::Data PostgreSQL::client) +target_link_libraries(DataPostgreSQL PUBLIC Poco::Data PostgreSQL::PostgreSQL) target_include_directories(DataPostgreSQL PUBLIC $ diff --git a/README.md b/README.md index 022e2ff14..58ea761f8 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ and [Getting Started](https://pocoproject.org/docs/00200-GettingStarted.html) do ### Prerequisites -- CMake 3.5 or newer +- CMake 3.15 or newer - A C++17 compiler (Visual C++ 2017, GCC 8.0, Clang 5, or newer) - OpenSSL headers and libraries (optional, but recommended) - MySQL, PostgreSQL and ODBC client libraries (optional) @@ -76,7 +76,7 @@ $ brew install cmake openssl mysql-client libpq ### Building with CMake (Linux, macOS, Windows) -[CMake](https://cmake.org) (version 3.5 or newer) is the recommended build system for +[CMake](https://cmake.org) (version 3.15 or newer) is the recommended build system for building the POCO C++ Libraries. ``` diff --git a/cmake/FindODBC.cmake b/cmake/FindODBC.cmake deleted file mode 100644 index 3c59fd380..000000000 --- a/cmake/FindODBC.cmake +++ /dev/null @@ -1,148 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.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 AND NOT MINGW) - 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_kit_include_dirs "${kit_dir}/Include/um" "${kit81_dir}/Include/um") -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/include/libiodbc - /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" - ${_odbc_kit_include_dirs} - PATH_SUFFIXES - odbc - iodbc - DOC "Specify the directory containing sql.h." -) - -if(NOT ODBC_INCLUDE_DIR AND WIN32) - set(ODBC_INCLUDE_DIR "") -else() - 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/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" - "${kit81_dir}/Lib/winv6.3/um" - "${kit_dir}/Lib/win8/um" - PATH_SUFIXES - odbc - ${WIN_ARCH} - DOC "Specify the ODBC driver manager library here." -) - -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) diff --git a/cmake/FindPostgreSQL.cmake b/cmake/FindPostgreSQL.cmake deleted file mode 100644 index 9163b90fa..000000000 --- a/cmake/FindPostgreSQL.cmake +++ /dev/null @@ -1,212 +0,0 @@ -# TODO(Bjoe) This is taken from cmake 3.10. For poco we need some changes here. Maybe we create an issue on cmake project -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindPostgreSQL -# -------------- -# -# Find the PostgreSQL installation. -# -# This module defines -# -# :: -# -# 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 - the version of PostgreSQL found (since CMake 2.8.8) - -# ---------------------------------------------------------------------------- -# History: -# This module is derived from the module originally found in the VTK source tree. -# -# ---------------------------------------------------------------------------- -# Note: -# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the -# version mumber of the implementation of PostgreSQL. -# In Windows the default installation of PostgreSQL uses that as part of the path. -# E.g C:\Program Files\PostgreSQL\8.4. -# Currently, the following version numbers are known to this module: -# "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" -# -# To use this variable just do something like this: -# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") -# before calling find_package(PostgreSQL) in your CMakeLists.txt file. -# This will mean that the versions you set here will be found first in the order -# specified before the default ones are searched. -# -# ---------------------------------------------------------------------------- -# 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. -# -# ---------------------------------------------------------------------------- -# The following variables are set if PostgreSQL is found: -# PostgreSQL_FOUND - Set to true when PostgreSQL is found. -# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL -# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries -# PostgreSQL_LIBRARIES - The PostgreSQL libraries. -# -# ---------------------------------------------------------------------------- -# If you have installed PostgreSQL in a non-standard location. -# (Please note that in the following comments, it is assumed that -# points to the root directory of the include directory of PostgreSQL.) -# Then you have three options. -# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to /include and -# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is -# 2) Use CMAKE_INCLUDE_PATH to set a path to /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} "/include") -# 3) Set an environment variable called ${PostgreSQL_ROOT} / ${PostgreSQL_ROOT_DIR} that points to the root of where you have -# installed PostgreSQL, e.g. . -# -# ---------------------------------------------------------------------------- - -set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include") -set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}") -set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.") -set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}") -set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4") - - -set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") - -# Define additional search paths for root directories. -set(PostgreSQL_ROOT_DIRECTORIES - ENV PostgreSQL_ROOT - ${PostgreSQL_ROOT} - ${PostgreSQL_ROOT_DIR} -) -foreach(suffix ${PostgreSQL_KNOWN_VERSIONS}) - if(WIN32) - list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES - "PostgreSQL/${suffix}/lib") - list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES - "PostgreSQL/${suffix}/include") - list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES - "PostgreSQL/${suffix}/include/server") - endif() - if(UNIX) - list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES - "pgsql-${suffix}/lib") - list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES - "pgsql-${suffix}/include") - list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES - "postgresql/${suffix}/server" - "pgsql-${suffix}/include/server") - endif() -endforeach() - -if(UNIX) - list(APPEND PostgreSQL_ROOT_DIRECTORIES - "/usr") - list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES - "include/postgresql") -endif() - -# -# Look for an installation. -# -find_path(PostgreSQL_INCLUDE_DIR - NAMES libpq-fe.h - HINTS - ${PostgreSQL_ROOT_INCLUDE_DIRS} - PATHS - # Look in other places. - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - pgsql - postgresql - include - ${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES} - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" -) - -# TODO(Bjoe) It is not needed to build an PostgreSQL client. Maybe create an issue on cmake project -# find_path(PostgreSQL_TYPE_INCLUDE_DIR -# NAMES catalog/pg_type.h -# PATHS -# # Look in other places. -# ${PostgreSQL_ROOT_DIRECTORIES} -# PATH_SUFFIXES -# postgresql -# pgsql/server -# postgresql/server -# include/server -# ${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES} -# # Help the user find it if we cannot. -# DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" -# ) - -# The PostgreSQL library. -set(PostgreSQL_LIBRARY_TO_FIND pq) -# Setting some more prefixes for the library -set(PostgreSQL_LIB_PREFIX "") -if(WIN32) - set(PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib") - set(PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) -endif() - -find_library(PostgreSQL_LIBRARY - NAMES ${PostgreSQL_LIBRARY_TO_FIND} - HINTS - ${PostgreSQL_ROOT_LIBRARY_DIRS} - PATHS - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - lib - ${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES} - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}" -) -get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) - -if(PostgreSQL_INCLUDE_DIR) - # Some platforms include multiple pg_config.hs for multi-lib configurations - # This is a temporary workaround. A better solution would be to compile - # a dummy c file and extract the value of the symbol. - file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h") - foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS}) - if(EXISTS "${_PG_CONFIG_HEADER}") - file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str - REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") - if(pgsql_version_str) - string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" - "\\1" PostgreSQL_VERSION "${pgsql_version_str}") - break() - endif() - endif() - endforeach() - unset(pgsql_version_str) -endif() - -# Did we find anything? -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - PostgreSQL - REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR #PostgreSQL_TYPE_INCLUDE_DIR - VERSION_VAR PostgreSQL_VERSION -) -set(PostgreSQL_FOUND ${POSTGRESQL_FOUND}) - -# Now try to get the include and library path. -if(PostgreSQL_FOUND) - set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ) #${PostgreSQL_TYPE_INCLUDE_DIR} ) - set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) - 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 diff --git a/cmake/V313/FindSQLite3.cmake b/cmake/V313/FindSQLite3.cmake deleted file mode 100644 index c144ca1d8..000000000 --- a/cmake/V313/FindSQLite3.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindSQLite3 ------------ - -Find the SQLite libraries, v3 - -IMPORTED targets -^^^^^^^^^^^^^^^^ - -This module defines the following :prop_tgt:`IMPORTED` target: - -``SQLite::SQLite3`` - -Result variables -^^^^^^^^^^^^^^^^ - -This module will set the following variables if found: - -``SQLite3_INCLUDE_DIRS`` - where to find sqlite3.h, etc. -``SQLite3_LIBRARIES`` - the libraries to link against to use SQLite3. -``SQLite3_VERSION`` - version of the SQLite3 library found -``SQLite3_FOUND`` - TRUE if found - -#]=======================================================================] - -# Look for the necessary header -find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h) -mark_as_advanced(SQLite3_INCLUDE_DIR) - -# Look for the necessary library -find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite) -mark_as_advanced(SQLite3_LIBRARY) - -# Extract version information from the header file -if(SQLite3_INCLUDE_DIR) - file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line - REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\"" - LIMIT_COUNT 1) - string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" - SQLite3_VERSION "${_ver_line}") - unset(_ver_line) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SQLite3 - REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY - VERSION_VAR SQLite3_VERSION) - -# Create the imported target -if(SQLite3_FOUND) - set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR}) - set(SQLite3_LIBRARIES ${SQLite3_LIBRARY}) - if(NOT TARGET SQLite::SQLite3) - add_library(SQLite::SQLite3 UNKNOWN IMPORTED) - set_target_properties(SQLite::SQLite3 PROPERTIES - IMPORTED_LOCATION "${SQLite3_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}") - endif() -endif() diff --git a/cmake/V33/FindOpenSSL.cmake b/cmake/V33/FindOpenSSL.cmake deleted file mode 100644 index d44a3aa3a..000000000 --- a/cmake/V33/FindOpenSSL.cmake +++ /dev/null @@ -1,463 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindOpenSSL -# ----------- -# -# Find the OpenSSL encryption library. -# -# Imported Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following :prop_tgt:`IMPORTED` targets: -# -# ``OpenSSL::SSL`` -# The OpenSSL ``ssl`` library, if found. -# ``OpenSSL::Crypto`` -# The OpenSSL ``crypto`` library, if found. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module will set the following variables in your project: -# -# ``OPENSSL_FOUND`` -# System has the OpenSSL library. -# ``OPENSSL_INCLUDE_DIR`` -# The OpenSSL include directory. -# ``OPENSSL_CRYPTO_LIBRARY`` -# The OpenSSL crypto library. -# ``OPENSSL_SSL_LIBRARY`` -# The OpenSSL SSL library. -# ``OPENSSL_LIBRARIES`` -# All OpenSSL libraries. -# ``OPENSSL_VERSION`` -# This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``). -# -# Hints -# ^^^^^ -# -# Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. -# Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. -# Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib. - -if (UNIX) - find_package(PkgConfig QUIET) - pkg_check_modules(_OPENSSL QUIET openssl) -endif () - -# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES -if(OPENSSL_USE_STATIC_LIBS) - set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) - endif() -endif() - -if (WIN32) - # http://www.slproweb.com/products/Win32OpenSSL.html - set(_OPENSSL_ROOT_HINTS - ${OPENSSL_ROOT_DIR} - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" - ENV OPENSSL_ROOT_DIR - ) - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) - set(_OPENSSL_ROOT_PATHS - "${_programfiles}/OpenSSL" - "${_programfiles}/OpenSSL-Win32" - "${_programfiles}/OpenSSL-Win64" - "C:/OpenSSL/" - "C:/OpenSSL-Win32/" - "C:/OpenSSL-Win64/" - ) - unset(_programfiles) -else () - set(_OPENSSL_ROOT_HINTS - ${OPENSSL_ROOT_DIR} - ENV OPENSSL_ROOT_DIR - ) -endif () - -set(_OPENSSL_ROOT_HINTS_AND_PATHS - HINTS ${_OPENSSL_ROOT_HINTS} - PATHS ${_OPENSSL_ROOT_PATHS} - ) - -find_path(OPENSSL_INCLUDE_DIR - NAMES - openssl/ssl.h - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - HINTS - ${_OPENSSL_INCLUDEDIR} - PATH_SUFFIXES - include -) - -if(WIN32 AND NOT CYGWIN) - if(MSVC) - # /MD and /MDd are the standard values - if someone wants to use - # others, the libnames have to change here too - # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b - # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL) - # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix: - # * MD for dynamic-release - # * MDd for dynamic-debug - # * MT for static-release - # * MTd for static-debug - - # Implementation details: - # We are using the libraries located in the VC subdir instead of the parent directory eventhough : - # libeay32MD.lib is identical to ../libeay32.lib, and - # ssleay32MD.lib is identical to ../ssleay32.lib - # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static - - if (OPENSSL_MSVC_STATIC_RT) - set(_OPENSSL_MSVC_RT_MODE "MT") - else () - set(_OPENSSL_MSVC_RT_MODE "MD") - endif () - - # Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib - if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" ) - set(_OPENSSL_MSVC_ARCH_SUFFIX "64") - else() - set(_OPENSSL_MSVC_ARCH_SUFFIX "32") - endif() - - if(OPENSSL_USE_STATIC_LIBS) - set(_OPENSSL_PATH_SUFFIXES - "lib/VC/static" - "VC/static" - "lib" - ) - else() - set(_OPENSSL_PATH_SUFFIXES - "lib/VC" - "VC" - "lib" - ) - endif () - - find_library(LIB_EAY_DEBUG - NAMES - libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d - libcrypto${_OPENSSL_MSVC_RT_MODE}d - libcryptod - libeay32${_OPENSSL_MSVC_RT_MODE}d - libeay32d - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - ${_OPENSSL_PATH_SUFFIXES} - ) - - find_library(LIB_EAY_RELEASE - NAMES - libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} - libcrypto${_OPENSSL_MSVC_RT_MODE} - libcrypto - libeay32${_OPENSSL_MSVC_RT_MODE} - libeay32 - crypto - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - ${_OPENSSL_PATH_SUFFIXES} - ) - - find_library(SSL_EAY_DEBUG - NAMES - libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d - libssl${_OPENSSL_MSVC_RT_MODE}d - libssld - ssleay32${_OPENSSL_MSVC_RT_MODE}d - ssleay32d - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - ${_OPENSSL_PATH_SUFFIXES} - ) - - find_library(SSL_EAY_RELEASE - NAMES - libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE} - libssl${_OPENSSL_MSVC_RT_MODE} - libssl - ssleay32${_OPENSSL_MSVC_RT_MODE} - ssleay32 - ssl - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - ${_OPENSSL_PATH_SUFFIXES} - ) - - set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") - set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}") - set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}") - set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}") - - include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) - select_library_configurations(LIB_EAY) - select_library_configurations(SSL_EAY) - - mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE - SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) - set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} ) - set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} ) - elseif(MINGW) - # same player, for MinGW - set(LIB_EAY_NAMES crypto libeay32) - set(SSL_EAY_NAMES ssl ssleay32) - find_library(LIB_EAY - NAMES - ${LIB_EAY_NAMES} - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - "lib/MinGW" - "lib" - ) - - find_library(SSL_EAY - NAMES - ${SSL_EAY_NAMES} - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES - "lib/MinGW" - "lib" - ) - - mark_as_advanced(SSL_EAY LIB_EAY) - set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) - set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) - unset(LIB_EAY_NAMES) - unset(SSL_EAY_NAMES) - else() - # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: - find_library(LIB_EAY - NAMES - libcrypto - libeay32 - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - HINTS - ${_OPENSSL_LIBDIR} - PATH_SUFFIXES - lib - ) - - find_library(SSL_EAY - NAMES - libssl - ssleay32 - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - HINTS - ${_OPENSSL_LIBDIR} - PATH_SUFFIXES - lib - ) - - mark_as_advanced(SSL_EAY LIB_EAY) - set(OPENSSL_SSL_LIBRARY ${SSL_EAY} ) - set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} ) - endif() -else() - - find_library(OPENSSL_SSL_LIBRARY - NAMES - ssl - ssleay32 - ssleay32MD - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - HINTS - ${_OPENSSL_LIBDIR} - PATH_SUFFIXES - lib - ) - - find_library(OPENSSL_CRYPTO_LIBRARY - NAMES - crypto - NAMES_PER_DIR - ${_OPENSSL_ROOT_HINTS_AND_PATHS} - HINTS - ${_OPENSSL_LIBDIR} - PATH_SUFFIXES - lib - ) - - mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) - - # compat defines - set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) - set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) - -endif() - -function(from_hex HEX DEC) - string(TOUPPER "${HEX}" HEX) - set(_res 0) - string(LENGTH "${HEX}" _strlen) - - while (_strlen GREATER 0) - math(EXPR _res "${_res} * 16") - string(SUBSTRING "${HEX}" 0 1 NIBBLE) - string(SUBSTRING "${HEX}" 1 -1 HEX) - if (NIBBLE STREQUAL "A") - math(EXPR _res "${_res} + 10") - elseif (NIBBLE STREQUAL "B") - math(EXPR _res "${_res} + 11") - elseif (NIBBLE STREQUAL "C") - math(EXPR _res "${_res} + 12") - elseif (NIBBLE STREQUAL "D") - math(EXPR _res "${_res} + 13") - elseif (NIBBLE STREQUAL "E") - math(EXPR _res "${_res} + 14") - elseif (NIBBLE STREQUAL "F") - math(EXPR _res "${_res} + 15") - else() - math(EXPR _res "${_res} + ${NIBBLE}") - endif() - - string(LENGTH "${HEX}" _strlen) - endwhile() - - set(${DEC} ${_res} PARENT_SCOPE) -endfunction() - -if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") - file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") - - if(openssl_version_str) - # The version number is encoded as 0xMNNFFPPS: major minor fix patch status - # The status gives if this is a developer or prerelease and is ignored here. - # Major, minor, and fix directly translate into the version numbers shown in - # the string. The patch field translates to the single character suffix that - # indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so - # on. - - string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$" - "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}") - list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR) - list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR) - from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR) - list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX) - from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX) - list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH) - - if (NOT OPENSSL_VERSION_PATCH STREQUAL "00") - from_hex("${OPENSSL_VERSION_PATCH}" _tmp) - # 96 is the ASCII code of 'a' minus 1 - math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96") - unset(_tmp) - # Once anyone knows how OpenSSL would call the patch versions beyond 'z' - # this should be updated to handle that, too. This has not happened yet - # so it is simply ignored here for now. - string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING) - endif () - - set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}") - endif () -endif () - -include(FindPackageHandleStandardArgs) - -set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ) - -if (OPENSSL_VERSION) - find_package_handle_standard_args(OpenSSL - REQUIRED_VARS - #OPENSSL_SSL_LIBRARY # FIXME: require based on a component request? - OPENSSL_CRYPTO_LIBRARY - OPENSSL_INCLUDE_DIR - VERSION_VAR - OPENSSL_VERSION - FAIL_MESSAGE - "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" - ) -else () - find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" - #OPENSSL_SSL_LIBRARY # FIXME: require based on a component request? - OPENSSL_CRYPTO_LIBRARY - OPENSSL_INCLUDE_DIR - ) -endif () - -mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) - -if(OPENSSL_FOUND) - if(NOT TARGET OpenSSL::Crypto AND - (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR - EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR - EXISTS "${LIB_EAY_LIBRARY_RELEASE}") - ) - add_library(OpenSSL::Crypto UNKNOWN IMPORTED) - set_target_properties(OpenSSL::Crypto PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") - if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}") - set_target_properties(OpenSSL::Crypto PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}") - endif() - if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}") - set_property(TARGET OpenSSL::Crypto APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(OpenSSL::Crypto PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" - IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}") - endif() - if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}") - set_property(TARGET OpenSSL::Crypto APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(OpenSSL::Crypto PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" - IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}") - endif() - endif() - if(NOT TARGET OpenSSL::SSL AND - (EXISTS "${OPENSSL_SSL_LIBRARY}" OR - EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR - EXISTS "${SSL_EAY_LIBRARY_RELEASE}") - ) - add_library(OpenSSL::SSL UNKNOWN IMPORTED) - set_target_properties(OpenSSL::SSL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") - if(EXISTS "${OPENSSL_SSL_LIBRARY}") - set_target_properties(OpenSSL::SSL PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}") - endif() - if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}") - set_property(TARGET OpenSSL::SSL APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(OpenSSL::SSL PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" - IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}") - endif() - if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}") - set_property(TARGET OpenSSL::SSL APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(OpenSSL::SSL PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" - IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}") - endif() - if(TARGET OpenSSL::Crypto) - set_target_properties(OpenSSL::SSL PROPERTIES - INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) - endif() - endif() -endif() - -# Restore the original find library ordering -if(OPENSSL_USE_STATIC_LIBS) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) -endif() diff --git a/cmake/V39/FindEXPAT.cmake b/cmake/V39/FindEXPAT.cmake deleted file mode 100644 index 1412fafc4..000000000 --- a/cmake/V39/FindEXPAT.cmake +++ /dev/null @@ -1,79 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindEXPAT -# --------- -# -# Find the native Expat headers and library. -# -# Imported Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following :prop_tgt:`IMPORTED` targets: -# -# ``EXPAT::EXPAT`` -# The Expat ``expat`` library, if found. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module will set the following variables in your project: -# -# ``EXPAT_INCLUDE_DIRS`` -# where to find expat.h, etc. -# ``EXPAT_LIBRARIES`` -# the libraries to link against to use Expat. -# ``EXPAT_FOUND`` -# true if the Expat headers and libraries were found. -# - -find_package(PkgConfig QUIET) - -pkg_check_modules(PC_EXPAT QUIET expat) - -# Look for the header file. -find_path(EXPAT_INCLUDE_DIR NAMES expat.h HINTS ${PC_EXPAT_INCLUDE_DIRS}) - -# Look for the library. -find_library(EXPAT_LIBRARY NAMES expat libexpat HINTS ${PC_EXPAT_LIBRARY_DIRS}) - -if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") - file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str - REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$") - - unset(EXPAT_VERSION_STRING) - foreach(VPART MAJOR MINOR MICRO) - foreach(VLINE ${expat_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$") - set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}") - if(EXPAT_VERSION_STRING) - string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}") - else() - set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}") - endif() - endif() - endforeach() - endforeach() -endif () - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT - REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR - VERSION_VAR EXPAT_VERSION_STRING) - -# Copy the results to the output variables and target. -if(EXPAT_FOUND) - set(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) - set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) - - if(NOT TARGET EXPAT::EXPAT) - add_library(EXPAT::EXPAT UNKNOWN IMPORTED) - set_target_properties(EXPAT::EXPAT PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${EXPAT_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIRS}") - endif() -endif() - -mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)