diff --git a/.travis.yml b/.travis.yml index 6b4565494..71d3bd77d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -123,11 +123,10 @@ jobs: apt: packages: - libssl-dev - - libmysqlclient-dev compiler: gcc script: # skip some libs due to build timeout - - ./configure --everything --omit=PDF,Data/ODBC,Data/PostgreSQL,Redis && make all -s -j2 && sudo make install + - ./configure --everything --omit=PDF,Data/MySQL,Data/ODBC,Data/PostgreSQL,MongoDB,Redis && make all -s -j2 && sudo make install - sudo -s ./travis/runtests.sh - name: Linux (gcc, make, ppc64le) diff --git a/ApacheConnector/CMakeLists.txt b/ApacheConnector/CMakeLists.txt index 3d674544f..86d7210a5 100644 --- a/ApacheConnector/CMakeLists.txt +++ b/ApacheConnector/CMakeLists.txt @@ -1,26 +1,26 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) add_library(mod_poco SHARED ${SRCS}) set_target_properties(mod_poco - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - DEFINE_SYMBOL ApacheHandlers_EXPORTS) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL ApacheHandlers_EXPORTS) target_include_directories(mod_poco - PUBLIC - $ - $ + PUBLIC + $ + $ PRIVATE ${APACHE2_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src - ) +) target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net Apache::Apr Apache::Aprutil) -if (ENABLE_TESTS) - add_subdirectory(samples) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) +endif() diff --git a/ApacheConnector/samples/CMakeLists.txt b/ApacheConnector/samples/CMakeLists.txt index e584a1a2e..fa1229091 100644 --- a/ApacheConnector/samples/CMakeLists.txt +++ b/ApacheConnector/samples/CMakeLists.txt @@ -1,2 +1,2 @@ -add_subdirectory( FormServer ) -add_subdirectory( TimeServer ) +add_subdirectory(FormServer) +add_subdirectory(TimeServer) diff --git a/CHANGELOG b/CHANGELOG index 32b8ec014..6d818640c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,11 @@ Release 1.10.1 (2020-02-10) - GH #2909: Test failures on s390x architecture with 1.10.0 - GH #2911: Poco::UTF16Encoding and Poco::UTF32Encoding byte order conversion bug - GH #2912: Poco::SHA2Engine computes incorrect hash on big-endian systems +- GH #2923: cmake: Version 1.10.0 not parsed correctly from VERSION file +- GH #2908: [Windows] Process arguments quoting is broken. +- GH #2894: Poco 1.10.0 doesn't build with cmake & POCO_UNBUNDLED +- GH #2920: Close Service Handle after DeleteService Function call +- GH #2919: Fixed Crash in WinService::setFailureActions - MySQL: resetting the session when putting it back into a SessionPool is now optional (and disabled by default) due to a bug in MySQL messing up the character encoding when doing so. - Poco::AutoPtr and Poco::SharedPtr now support comparison with nullptr. diff --git a/CMakeLists.txt b/CMakeLists.txt index 9766cee16..fc9a796aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,9 @@ project(Poco) file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION) # Read the version information from the VERSION file -file (STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION ) +file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION) string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION}) -string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION}) string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION}) set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) @@ -40,37 +40,42 @@ check_for_cxx14_compiler(CXX14_COMPILER) # If a C++14 compiler is available, then set the appropriate flags if(CXX14_COMPILER) - set (CMAKE_CXX_STANDARD 14) - set (CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) else() - message(FATAL_ERROR "Compiler does not support C++14." ) + message(FATAL_ERROR "Compiler does not support C++14.") endif() if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "RelWithDebInfo") + set(CMAKE_BUILD_TYPE "RelWithDebInfo") endif() # Include some common macros to simpilfy the Poco CMake files include(PocoMacros) -option(BUILD_SHARED_LIBS "Build shared libraries" ON) +if(POCO_STATIC) + message(WARNING "POCO_STATIC has been deprecated. Please use BUILD_SHARED_LIBS instead.") + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) +else() + option(BUILD_SHARED_LIBS "Build shared libraries" ON) +endif() if(MSVC) - option(POCO_MT "Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD" OFF) - option(ENABLE_MSVC_MP "Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC" ON) - - if(BUILD_SHARED_LIBS AND POCO_MT) - message(FATAL_ERROR "Cannot have both BUILD_SHARED_LIBS and POCO_MT") - endif() + option(POCO_MT "Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD" OFF) + option(ENABLE_MSVC_MP "Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC" 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, - # the internal OpenSSL build will be used - option(POCO_DISABLE_INTERNAL_OPENSSL "Disable internal OpensSSL binaries use" ON) + if(BUILD_SHARED_LIBS AND POCO_MT) + message(FATAL_ERROR "Cannot have both BUILD_SHARED_LIBS and POCO_MT") + endif() - if((NOT POCO_DISABLE_INTERNAL_OPENSSL) AND (ENABLE_NETSSL OR ENABLE_CRYPTO OR (ENABLE_DATA_MYSQL AND MINGW))) - include(UseEmbeddedOpenSSL) - endif() + # 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) + + if((NOT POCO_DISABLE_INTERNAL_OPENSSL) AND (ENABLE_NETSSL OR ENABLE_CRYPTO OR (ENABLE_DATA_MYSQL AND MINGW))) + include(UseEmbeddedOpenSSL) + endif() endif() option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF) @@ -93,62 +98,62 @@ else() endif() if(ENABLE_APACHECONNECTOR) - find_package(APR REQUIRED) + find_package(APR REQUIRED) find_package(APRUTIL REQUIRED) find_package(Apache2 REQUIRED) else() - find_package(APR) + find_package(APR) find_package(APRUTIL) find_package(Apache2) endif() if(APR_FOUND AND APRUTIL_FOUND AND APACHE2_FOUND AND - EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR) - option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON) + EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR) + option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON) else() - option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF) + option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF) endif() if(ENABLE_DATA_MYSQL) - find_package(MySQL REQUIRED) + find_package(MySQL REQUIRED) else() - find_package(MySQL) + find_package(MySQL) endif() if(MYSQL_FOUND) - option(ENABLE_DATA "Enable Data" ON) - option(ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" ON) + option(ENABLE_DATA "Enable Data" ON) + option(ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" ON) else() - option(ENABLE_DATA "Enable Data" OFF) - option(ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" OFF) + option(ENABLE_DATA "Enable Data" OFF) + option(ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" OFF) endif() if(ENABLE_DATA_POSTGRESQL) - find_package(PostgreSQL REQUIRED) + find_package(PostgreSQL REQUIRED) else() - find_package(PostgreSQL) + find_package(PostgreSQL) endif() if(PostgreSQL_FOUND) - option(ENABLE_DATA "Enable SQL" ON) - option(ENABLE_DATA_POSTGRESQL "Enable SQL PosgreSQL" ON) + option(ENABLE_DATA "Enable SQL" ON) + option(ENABLE_DATA_POSTGRESQL "Enable SQL PosgreSQL" ON) else() - option(ENABLE_DATA "Enable SQL" OFF) - option(ENABLE_DATA_POSTGRESQL "Enable SQL PosgreSQL" OFF) + option(ENABLE_DATA "Enable SQL" OFF) + option(ENABLE_DATA_POSTGRESQL "Enable SQL PosgreSQL" OFF) endif() if(ENABLE_DATA_ODBC) - find_package(ODBC REQUIRED) + find_package(ODBC REQUIRED) else() - find_package(ODBC) + find_package(ODBC) endif() if(ODBC_FOUND) - option(ENABLE_DATA "Enable Data" ON) - option(ENABLE_DATA_ODBC "Enable Data ODBC" ON) + option(ENABLE_DATA "Enable Data" ON) + option(ENABLE_DATA_ODBC "Enable Data ODBC" ON) else() - option(ENABLE_DATA "Enable Data" OFF) - option(ENABLE_DATA_ODBC "Enable Data ODBC" OFF) + option(ENABLE_DATA "Enable Data" OFF) + option(ENABLE_DATA_ODBC "Enable Data ODBC" OFF) endif() # Allow enabling and disabling components @@ -172,23 +177,23 @@ option(ENABLE_PAGECOMPILER "Enable PageCompiler" ON) option(ENABLE_PAGECOMPILER_FILE2PAGE "Enable File2Page" ON) option(ENABLE_TESTS - "Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF) + "Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF) option(POCO_UNBUNDLED - "Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF) + "Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF) if(ENABLE_TESTS) - include(CTest) - enable_testing() - message(STATUS "Building with unittests & samples") + include(CTest) + enable_testing() + message(STATUS "Building with unittests & samples") else() - message(STATUS "Building without tests & samples") + message(STATUS "Building without tests & samples") endif() if(POCO_UNBUNDLED) - message(STATUS "Using external sqlite, zlib, pcre, expat, ...") + message(STATUS "Using external sqlite, zlib, pcre, expat, ...") else() - message(STATUS "Using internal sqlite, zlib, pcre, expat, ...") + message(STATUS "Using internal sqlite, zlib, pcre, expat, ...") endif() include(DefinePlatformSpecifc) @@ -197,217 +202,218 @@ include(DefinePlatformSpecifc) set(Poco_COMPONENTS "") if(ENABLE_TESTS) - add_subdirectory(CppUnit) - set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE ) - set(ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE) + add_subdirectory(CppUnit) + set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) + set(ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE) - if(ENABLE_ZIP) - set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) - endif() + if(ENABLE_ZIP) + set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) + endif() endif() if(ENABLE_ENCODINGS_COMPILER OR ENABLE_APACHECONNECTOR) - set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) endif() if(ENABLE_PAGECOMPILER_FILE2PAGE) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) endif() if(ENABLE_PAGECOMPILER) - set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) endif() if(ENABLE_MONGODB OR ENABLE_REDIS) - set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) + set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) endif() if(ENABLE_DATA_SQLITE OR ENABLE_DATA_MYSQL OR ENABLE_DATA_ODBC OR ENABLE_DATA_POSTGRESQL) - 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() + 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() endif() if(ENABLE_DATA AND ENABLE_TESTS) - set(ENABLE_DATA_SQLITE ON CACHE BOOL "Enable Data SQlite" FORCE) + set(ENABLE_DATA_SQLITE ON CACHE BOOL "Enable Data SQlite" FORCE) endif() if(ENABLE_NETSSL_WIN) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) - if(ENABLE_TESTS) - set(ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE) - endif() + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + if(ENABLE_TESTS) + set(ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE) + endif() endif() if(ENABLE_NETSSL) set(ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE) - set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_NET ON CACHE BOOL "Enable Net" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) endif() if(ENABLE_CRYPTO AND ENABLE_TESTS) - 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) + 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) endif() if(ENABLE_NET AND ENABLE_TESTS) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) endif() if(ENABLE_PDF) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) - set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) endif() if(ENABLE_POCODOC) - 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) + 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) endif() if(ENABLE_SEVENZIP OR ENABLE_ZIP) - set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) - set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) + set(ENABLE_UTIL ON CACHE BOOL "Enable Util" FORCE) + set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) endif() if(ENABLE_UTIL AND ENABLE_TESTS) - set(ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE) - set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) + set(ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE) + set(ENABLE_XML ON CACHE BOOL "Enable XML" FORCE) endif() if(ENABLE_JWT) set(ENABLE_CRYPTO ON CACHE BOOL "Enable Crypto" FORCE) - set(ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE) + set(ENABLE_JSON ON CACHE BOOL "Enable JSON" FORCE) endif() if(ENABLE_FOUNDATION) - add_subdirectory(Foundation) + add_subdirectory(Foundation) endif() if(ENABLE_ENCODINGS) - add_subdirectory(Encodings) - list(APPEND Poco_COMPONENTS "Encodings") + add_subdirectory(Encodings) + list(APPEND Poco_COMPONENTS "Encodings") endif() if(ENABLE_XML) - add_subdirectory(XML) - list(APPEND Poco_COMPONENTS "XML") + add_subdirectory(XML) + list(APPEND Poco_COMPONENTS "XML") endif() if(ENABLE_JSON) - add_subdirectory(JSON) - list(APPEND Poco_COMPONENTS "JSON") + add_subdirectory(JSON) + list(APPEND Poco_COMPONENTS "JSON") endif() if(ENABLE_UTIL) - add_subdirectory(Util) - list(APPEND Poco_COMPONENTS "Util") + add_subdirectory(Util) + list(APPEND Poco_COMPONENTS "Util") endif() if(ENABLE_NET) - add_subdirectory(Net) - list(APPEND Poco_COMPONENTS "Net") + add_subdirectory(Net) + list(APPEND Poco_COMPONENTS "Net") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/MongoDB AND ENABLE_MONGODB) - add_subdirectory(MongoDB) - list(APPEND Poco_COMPONENTS "MongoDB") + add_subdirectory(MongoDB) + list(APPEND Poco_COMPONENTS "MongoDB") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/Redis AND ENABLE_REDIS) - add_subdirectory(Redis) - list(APPEND Poco_COMPONENTS "Redis") + add_subdirectory(Redis) + list(APPEND Poco_COMPONENTS "Redis") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/PDF AND ENABLE_PDF) - add_subdirectory(PDF) - list(APPEND Poco_COMPONENTS "PDF") + add_subdirectory(PDF) + list(APPEND Poco_COMPONENTS "PDF") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/JWT AND ENABLE_JWT) - add_subdirectory(JWT) - list(APPEND Poco_COMPONENTS "JWT") + add_subdirectory(JWT) + list(APPEND Poco_COMPONENTS "JWT") endif() #NetSSL if(WIN32 AND EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_Win AND ENABLE_NETSSL_WIN) - add_subdirectory(NetSSL_Win) - list(APPEND Poco_COMPONENTS "NetSSL_Win") + add_subdirectory(NetSSL_Win) + list(APPEND Poco_COMPONENTS "NetSSL_Win") endif(WIN32 AND EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_Win AND ENABLE_NETSSL_WIN) if(OPENSSL_FOUND) - 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() + 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() endif(OPENSSL_FOUND) if(EXISTS ${PROJECT_SOURCE_DIR}/Data AND ENABLE_DATA) - add_subdirectory(Data) - list(APPEND Poco_COMPONENTS "Data") + add_subdirectory(Data) + list(APPEND Poco_COMPONENTS "Data") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/SevenZip AND ENABLE_SEVENZIP) - add_subdirectory(SevenZip) - list(APPEND Poco_COMPONENTS "SevenZip") + add_subdirectory(SevenZip) + list(APPEND Poco_COMPONENTS "SevenZip") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/Zip AND ENABLE_ZIP) - add_subdirectory(Zip) - list(APPEND Poco_COMPONENTS "Zip") + add_subdirectory(Zip) + list(APPEND Poco_COMPONENTS "Zip") endif() if(APRUTIL_FOUND AND APACHE_FOUND AND - EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR) - add_subdirectory(ApacheConnector) - list(APPEND Poco_COMPONENTS "ApacheConnector") + EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR) + add_subdirectory(ApacheConnector) + list(APPEND Poco_COMPONENTS "ApacheConnector") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/CppParser AND ENABLE_CPPPARSER) - add_subdirectory(CppParser) - list(APPEND Poco_COMPONENTS "CppParser") + add_subdirectory(CppParser) + list(APPEND Poco_COMPONENTS "CppParser") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/PocoDoc AND ENABLE_POCODOC) - add_subdirectory(PocoDoc) - list(APPEND Poco_COMPONENTS "PocoDoc") + add_subdirectory(PocoDoc) + list(APPEND Poco_COMPONENTS "PocoDoc") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/PageCompiler AND ENABLE_PAGECOMPILER) - add_subdirectory(PageCompiler) - list(APPEND Poco_COMPONENTS "PageCompiler") + add_subdirectory(PageCompiler) + list(APPEND Poco_COMPONENTS "PageCompiler") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/PageCompiler/File2Page AND ENABLE_PAGECOMPILER_FILE2PAGE) - add_subdirectory(PageCompiler/File2Page) - list(APPEND Poco_COMPONENTS "File2Page") + add_subdirectory(PageCompiler/File2Page) + list(APPEND Poco_COMPONENTS "File2Page") endif() if(EXISTS ${PROJECT_SOURCE_DIR}/Encodings/Compiler AND 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 @@ -427,38 +433,38 @@ 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 # look for, which is different on MS Windows than for UNIX # Note: also set in POCO_GENERATE_PACKAGE macro in cmake/PocoMacros.cmake -if (WIN32) - set(PocoConfigPackageLocation "cmake") +if(WIN32) + set(PocoConfigPackageLocation "cmake") else() - set(PocoConfigPackageLocation "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}") + set(PocoConfigPackageLocation "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}") endif() configure_file(cmake/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" @ONLY) install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION - "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}" - COMPONENT - Devel + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake + DESTINATION + "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}" + COMPONENT + Devel ) if(POCO_UNBUNDLED) - install(FILES cmake/FindPCRE.cmake - DESTINATION "${PocoConfigPackageLocation}") - install(FILES cmake/V39/FindEXPAT.cmake - DESTINATION "${PocoConfigPackageLocation}/V39") - install(FILES cmake/V313/FindSQLite3.cmake - DESTINATION "${PocoConfigPackageLocation}/V313") + install(FILES cmake/FindPCRE.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") @@ -470,16 +476,16 @@ else() endif() message(STATUS "[cmake] Installation target path: ${CMAKE_INSTALL_PREFIX}") if(CMAKE_TOOLCHAIN_FILE) - message(STATUS "[cmake] Use toolchain file: ${CMAKE_TOOLCHAIN_FILE}") + message(STATUS "[cmake] Use toolchain file: ${CMAKE_TOOLCHAIN_FILE}") endif() -message(STATUS "[cmake] Bulid 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}") +message(STATUS "[cmake] Bulid 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}") string(TOUPPER "${CMAKE_BUILD_TYPE}" 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}") +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}") + message(STATUS "Building: ${component}") endforeach() diff --git a/CppParser/CMakeLists.txt b/CppParser/CMakeLists.txt index 00f7a7b41..7e41461e5 100644 --- a/CppParser/CMakeLists.txt +++ b/CppParser/CMakeLists.txt @@ -1,38 +1,38 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() add_library(CppParser ${SRCS}) add_library(Poco::CppParser ALIAS CppParser) set_target_properties(CppParser - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoCppParser - DEFINE_SYMBOL CppParser_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoCppParser + DEFINE_SYMBOL CppParser_EXPORTS +) target_link_libraries(CppParser PUBLIC Poco::Foundation) target_include_directories(CppParser - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(CppParser) POCO_GENERATE_PACKAGE(CppParser) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(testsuite) +endif() diff --git a/CppParser/testsuite/CMakeLists.txt b/CppParser/testsuite/CMakeLists.txt index 5a1d0929f..1b1f39281 100644 --- a/CppParser/testsuite/CMakeLists.txt +++ b/CppParser/testsuite/CMakeLists.txt @@ -1,21 +1,28 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -add_executable(CppParser-testrunner ${TEST_SRCS} ) +add_executable(CppParser-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME CppParser WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/CppParser-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME CppParser + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/CppParser-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME CppParser WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND CppParser-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(CppParser PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME CppParser + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND CppParser-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(CppParser PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(CppParser-testrunner PUBLIC Poco::CppParser CppUnit) diff --git a/CppUnit/CMakeLists.txt b/CppUnit/CMakeLists.txt index 2ef15c715..c367bd2bb 100644 --- a/CppUnit/CMakeLists.txt +++ b/CppUnit/CMakeLists.txt @@ -1,33 +1,33 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) add_library(CppUnit ${SRCS}) add_library(Poco::CppUnit ALIAS CppUnit) set_target_properties(CppUnit - PROPERTIES - VERSION "1" SOVERSION "1" - OUTPUT_NAME CppUnit - DEFINE_SYMBOL CppUnit_EXPORTS - ) + PROPERTIES + VERSION "1" SOVERSION "1" + OUTPUT_NAME CppUnit + DEFINE_SYMBOL CppUnit_EXPORTS +) target_link_libraries(CppUnit PUBLIC Poco::Foundation) target_include_directories(CppUnit - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src +) if(NOT BUILD_SHARED_LIBS) - target_compile_definitions(CppUnit - PUBLIC - POCO_STATIC - ) + target_compile_definitions(CppUnit + PUBLIC + POCO_STATIC + ) elseif(MINGW) target_compile_definitions(CppUnit PUBLIC diff --git a/Crypto/CMakeLists.txt b/Crypto/CMakeLists.txt index 9f0195903..9204a91cb 100644 --- a/Crypto/CMakeLists.txt +++ b/Crypto/CMakeLists.txt @@ -1,37 +1,37 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(Crypto ${SRCS} ) +add_library(Crypto ${SRCS}) add_library(Poco::Crypto ALIAS Crypto) set_target_properties(Crypto - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoCrypto - DEFINE_SYMBOL Crypto_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoCrypto + DEFINE_SYMBOL Crypto_EXPORTS +) target_link_libraries(Crypto PUBLIC Poco::Foundation OpenSSL::SSL OpenSSL::Crypto) target_include_directories(Crypto - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src +) if(MSVC AND POCO_DISABLE_INTERNAL_OPENSSL) - target_compile_definitions(Crypto PUBLIC POCO_EXTERNAL_OPENSSL) + target_compile_definitions(Crypto PUBLIC POCO_EXTERNAL_OPENSSL) if(OPENSSL_USE_STATIC_LIBS) target_link_libraries(Crypto PUBLIC ws2_32.lib Crypt32.lib) endif() @@ -40,7 +40,7 @@ endif() POCO_INSTALL(Crypto) POCO_GENERATE_PACKAGE(Crypto) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/Crypto/samples/CMakeLists.txt b/Crypto/samples/CMakeLists.txt index 2dbff2363..55e3a8706 100644 --- a/Crypto/samples/CMakeLists.txt +++ b/Crypto/samples/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory( genrsakey ) +add_subdirectory(genrsakey) diff --git a/Crypto/testsuite/CMakeLists.txt b/Crypto/testsuite/CMakeLists.txt index 89cb393f8..a7ae3e990 100644 --- a/Crypto/testsuite/CMakeLists.txt +++ b/Crypto/testsuite/CMakeLists.txt @@ -1,28 +1,35 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Crypto-testrunner ${TEST_SRCS} ) +add_executable(Crypto-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Crypto WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Crypto-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Crypto + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Crypto-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Crypto WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Crypto-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Crypto PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME Crypto + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND Crypto-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Crypto PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(Crypto-testrunner PUBLIC Poco::NetSSL Poco::XML CppUnit) if(UNIX AND NOT ANDROID) - target_link_libraries(Crypto-testrunner PUBLIC pthread) + target_link_libraries(Crypto-testrunner PUBLIC pthread) endif(UNIX AND NOT ANDROID) diff --git a/Data/CMakeLists.txt b/Data/CMakeLists.txt index 8e794a64a..7d1e99ea9 100644 --- a/Data/CMakeLists.txt +++ b/Data/CMakeLists.txt @@ -1,72 +1,72 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) if(MSVC AND NOT(MSVC_VERSION LESS 1400)) - set_source_files_properties(src/StatementImpl.cpp - PROPERTIES COMPILE_FLAGS "/bigobj") + set_source_files_properties(src/StatementImpl.cpp + PROPERTIES COMPILE_FLAGS "/bigobj") endif() # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(Data ${SRCS} ) +add_library(Data ${SRCS}) add_library(Poco::Data ALIAS Data) set_target_properties(Data - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoData - DEFINE_SYMBOL Data_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoData + DEFINE_SYMBOL Data_EXPORTS +) target_link_libraries(Data PUBLIC Poco::Foundation) target_include_directories(Data - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(Data) POCO_GENERATE_PACKAGE(Data) if(ENABLE_DATA_SQLITE) - # SQlite3 is built in any case - message(STATUS "SQLite Support Enabled") - add_subdirectory( SQLite ) + # SQlite3 is built in any case + message(STATUS "SQLite Support Enabled") + add_subdirectory(SQLite) else(ENABLE_DATA_SQLITE) - message(STATUS "SQLite Support Disabled") + message(STATUS "SQLite Support Disabled") endif() if(MYSQL_FOUND AND ENABLE_DATA_MYSQL) - message(STATUS "MySQL Support Enabled") - add_subdirectory( MySQL ) + message(STATUS "MySQL Support Enabled") + add_subdirectory(MySQL) else() - message(STATUS "MySQL Support Disabled") + message(STATUS "MySQL Support Disabled") endif() if(POSTGRESQL_FOUND AND ENABLE_DATA_POSTGRESQL) - message(STATUS "PostgreSQL Support Enabled") - add_subdirectory( PostgreSQL ) + message(STATUS "PostgreSQL Support Enabled") + add_subdirectory(PostgreSQL) else() - message(STATUS "PostgreSQL Support Disabled") + message(STATUS "PostgreSQL Support Disabled") endif() if(ODBC_FOUND AND ENABLE_DATA_ODBC AND NOT WINCE) message(STATUS "ODBC Support Enabled") - add_subdirectory( ODBC ) + add_subdirectory(ODBC) else() message(STATUS "ODBC Support Disabled") endif() -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/Data/MySQL/CMakeLists.txt b/Data/MySQL/CMakeLists.txt index 68375cc95..f71b1453e 100644 --- a/Data/MySQL/CMakeLists.txt +++ b/Data/MySQL/CMakeLists.txt @@ -1,42 +1,42 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( MYSQL_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(MYSQL_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( MYSQL_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(MYSQL_SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND MYSQL_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND MYSQL_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(DataMySQL ${MYSQL_SRCS} ) +add_library(DataMySQL ${MYSQL_SRCS}) add_library(Poco::DataMySQL ALIAS DataMySQL) set_target_properties(DataMySQL - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoDataMySQL - DEFINE_SYMBOL MySQL_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoDataMySQL + DEFINE_SYMBOL MySQL_EXPORTS +) target_link_libraries(DataMySQL PUBLIC Poco::Data MySQL::client) target_include_directories(DataMySQL - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) target_compile_definitions(DataMySQL PUBLIC THREADSAFE NO_TCL) if(WIN32) - target_compile_definitions(DataMySQL PUBLIC __LCC__) #__LCC__ define used by MySQL.h + target_compile_definitions(DataMySQL PUBLIC __LCC__) #__LCC__ define used by MySQL.h endif() POCO_INSTALL(DataMySQL) POCO_GENERATE_PACKAGE(DataMySQL) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(testsuite) +endif() diff --git a/Data/MySQL/testsuite/CMakeLists.txt b/Data/MySQL/testsuite/CMakeLists.txt index 34fe5b51a..04b57b4cf 100644 --- a/Data/MySQL/testsuite/CMakeLists.txt +++ b/Data/MySQL/testsuite/CMakeLists.txt @@ -1,21 +1,28 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -add_executable(DataMySQL-testrunner ${TEST_SRCS} ) +add_executable(DataMySQL-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME DataMySQL WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/DataMySQL-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME DataMySQL + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/DataMySQL-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME DataMySQL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataMySQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(DataMySQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME DataMySQL + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND DataMySQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(DataMySQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(DataMySQL-testrunner PUBLIC Poco::DataMySQL CppUnit) diff --git a/Data/ODBC/CMakeLists.txt b/Data/ODBC/CMakeLists.txt index 7538ac54d..98cd133b8 100644 --- a/Data/ODBC/CMakeLists.txt +++ b/Data/ODBC/CMakeLists.txt @@ -1,38 +1,38 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( ODBC_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(ODBC_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( ODBC_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(ODBC_SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND ODBC_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND ODBC_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() add_library(DataODBC ${ODBC_SRCS}) add_library(Poco::DataODBC ALIAS DataODBC) set_target_properties(DataODBC - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoDataODBC - DEFINE_SYMBOL ODBC_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoDataODBC + DEFINE_SYMBOL ODBC_EXPORTS +) target_link_libraries(DataODBC PUBLIC Poco::Data ODBC::ODBC) target_include_directories(DataODBC - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) target_compile_definitions(DataODBC PUBLIC THREADSAFE) POCO_INSTALL(DataODBC) POCO_GENERATE_PACKAGE(DataODBC) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(testsuite) +endif() diff --git a/Data/ODBC/testsuite/CMakeLists.txt b/Data/ODBC/testsuite/CMakeLists.txt index 55d65f7ff..f2938060f 100644 --- a/Data/ODBC/testsuite/CMakeLists.txt +++ b/Data/ODBC/testsuite/CMakeLists.txt @@ -1,21 +1,28 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -add_executable(DataODBC-testrunner ${TEST_SRCS} ) +add_executable(DataODBC-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME DataODBC WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/DataODBC-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME DataODBC + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/DataODBC-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME DataODBC WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataODBC-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(DataODBC PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME DataODBC + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND DataODBC-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(DataODBC PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(DataODBC-testrunner PUBLIC Poco::DataODBC CppUnit) diff --git a/Data/PostgreSQL/CMakeLists.txt b/Data/PostgreSQL/CMakeLists.txt index 153c269fe..f727fc0c7 100644 --- a/Data/PostgreSQL/CMakeLists.txt +++ b/Data/PostgreSQL/CMakeLists.txt @@ -1,31 +1,31 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( POSTGRESQL_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(POSTGRESQL_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( POSTGRESQL_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(POSTGRESQL_SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND POSTGRESQL_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND POSTGRESQL_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(DataPostgreSQL ${POSTGRESQL_SRCS} ) +add_library(DataPostgreSQL ${POSTGRESQL_SRCS}) add_library(Poco::DataPostgreSQL ALIAS DataPostgreSQL) set_target_properties(DataPostgreSQL - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoDataPostgreSQL - DEFINE_SYMBOL PostgreSQL_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoDataPostgreSQL + DEFINE_SYMBOL PostgreSQL_EXPORTS +) target_link_libraries(DataPostgreSQL PUBLIC Poco::Data PostgreSQL::client) target_include_directories(DataPostgreSQL - PUBLIC - $ - $ + PUBLIC + $ + $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) @@ -33,6 +33,6 @@ target_include_directories(DataPostgreSQL POCO_INSTALL(DataPostgreSQL) POCO_GENERATE_PACKAGE(DataPostgreSQL) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(testsuite) +endif() diff --git a/Data/PostgreSQL/testsuite/CMakeLists.txt b/Data/PostgreSQL/testsuite/CMakeLists.txt index f2fe47dbd..8afd77ded 100644 --- a/Data/PostgreSQL/testsuite/CMakeLists.txt +++ b/Data/PostgreSQL/testsuite/CMakeLists.txt @@ -1,16 +1,20 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -add_executable(DataPostgreSQL-testrunner ${TEST_SRCS} ) -add_test(NAME DataPostgreSQL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataPostgreSQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) +add_executable(DataPostgreSQL-testrunner ${TEST_SRCS}) +add_test( + NAME DataPostgreSQL + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND DataPostgreSQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all +) set_tests_properties(DataPostgreSQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) target_link_libraries(DataPostgreSQL-testrunner PUBLIC Poco::DataPostgreSQL CppUnit) diff --git a/Data/SQLite/CMakeLists.txt b/Data/SQLite/CMakeLists.txt index 7f4a526b8..b52e2c5c1 100644 --- a/Data/SQLite/CMakeLists.txt +++ b/Data/SQLite/CMakeLists.txt @@ -1,53 +1,53 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SQLITE_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SQLITE_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SQLITE_SRCS ${HDRS_G}) -if (POCO_UNBUNDLED) +if(POCO_UNBUNDLED) find_package(SQLite3 REQUIRED) else() - # sqlite3 - POCO_SOURCES( SQLITE_SRCS sqlite3 - src/sqlite3.c - ) + # sqlite3 + POCO_SOURCES(SQLITE_SRCS sqlite3 + src/sqlite3.c + ) - POCO_HEADERS( SQLITE_SRCS sqlite3 - src/sqlite3.h - ) + POCO_HEADERS(SQLITE_SRCS sqlite3 + src/sqlite3.h + ) endif() # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SQLITE_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SQLITE_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(DataSQLite ${SQLITE_SRCS} ) +add_library(DataSQLite ${SQLITE_SRCS}) add_library(Poco::DataSQLite ALIAS DataSQLite) set_target_properties(DataSQLite - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoDataSQLite - DEFINE_SYMBOL SQLite_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoDataSQLite + DEFINE_SYMBOL SQLite_EXPORTS +) target_link_libraries(DataSQLite PUBLIC Poco::Data) target_include_directories(DataSQLite - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) if(POCO_UNBUNDLED) - target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3) + target_link_libraries(DataSQLite PUBLIC SQLite::SQLite3) target_compile_definitions(DataSQLite PUBLIC POCO_UNBUNDLED SQLITE_THREADSAFE=1 - ) +) else() if(WINCE) target_compile_definitions(DataSQLite PRIVATE SQLITE_MSVC_LOCALTIME_API) @@ -66,7 +66,6 @@ endif() POCO_INSTALL(DataSQLite) POCO_GENERATE_PACKAGE(DataSQLite) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -endif () - +if(ENABLE_TESTS) + add_subdirectory(testsuite) +endif() diff --git a/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake b/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake index 690507393..5478bab1b 100644 --- a/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake +++ b/Data/SQLite/cmake/PocoDataSQLiteConfig.cmake @@ -2,10 +2,10 @@ include(CMakeFindDependencyMacro) find_dependency(PocoFoundation) find_dependency(PocoData) if(@POCO_UNBUNDLED@) - if(CMAKE_VERSION VERSION_LESS "3.14") - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V313") - endif() - find_dependency(SQLite3 REQUIRED) + if(CMAKE_VERSION VERSION_LESS "3.14") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V313") + endif() + find_dependency(SQLite3 REQUIRED) endif() include("${CMAKE_CURRENT_LIST_DIR}/PocoDataSQLiteTargets.cmake") diff --git a/Data/SQLite/testsuite/CMakeLists.txt b/Data/SQLite/testsuite/CMakeLists.txt index 72a16199e..73b8d5252 100644 --- a/Data/SQLite/testsuite/CMakeLists.txt +++ b/Data/SQLite/testsuite/CMakeLists.txt @@ -1,25 +1,32 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(DataSQLite-testrunner ${TEST_SRCS} ) +add_executable(DataSQLite-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME DataSQLite WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/DataSQLite-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME DataSQLite + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/DataSQLite-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME DataSQLite WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataSQLite-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(DataSQLite PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME DataSQLite + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND DataSQLite-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(DataSQLite PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(DataSQLite-testrunner PUBLIC Poco::DataSQLite CppUnit) diff --git a/Data/samples/CMakeLists.txt b/Data/samples/CMakeLists.txt index af851da6d..551d453cc 100644 --- a/Data/samples/CMakeLists.txt +++ b/Data/samples/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory( Binding ) -add_subdirectory( RecordSet ) -add_subdirectory( RowFormatter ) -add_subdirectory( Tuple ) -add_subdirectory( TypeHandler ) +add_subdirectory(Binding) +add_subdirectory(RecordSet) +add_subdirectory(RowFormatter) +add_subdirectory(Tuple) +add_subdirectory(TypeHandler) diff --git a/Data/testsuite/CMakeLists.txt b/Data/testsuite/CMakeLists.txt index 7d5502031..f7226d31d 100644 --- a/Data/testsuite/CMakeLists.txt +++ b/Data/testsuite/CMakeLists.txt @@ -1,30 +1,37 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) #TODO: Why is this file there? It doesn't compile if it is include in the sources -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/StatementImpl.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/StatementImpl.cpp ) -add_executable(Data-testrunner ${TEST_SRCS} ) +add_executable(Data-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Data WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Data-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Data + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Data-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Data WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Data-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME Data + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND Data-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit) diff --git a/Encodings/CMakeLists.txt b/Encodings/CMakeLists.txt index 71c1b0929..292062f89 100644 --- a/Encodings/CMakeLists.txt +++ b/Encodings/CMakeLists.txt @@ -1,38 +1,38 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES( SRCS Encodings ${SRCS_G}) +POCO_SOURCES(SRCS Encodings ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS( SRCS Encodings ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS(SRCS Encodings ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(Encodings ${SRCS} ) +add_library(Encodings ${SRCS}) add_library(Poco::Encodings ALIAS Encodings) set_target_properties(Encodings - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoEncodings - DEFINE_SYMBOL Encodings_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoEncodings + DEFINE_SYMBOL Encodings_EXPORTS +) target_link_libraries(Encodings PUBLIC Poco::Foundation) target_include_directories(Encodings - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(Encodings) POCO_GENERATE_PACKAGE(Encodings) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/Encodings/Compiler/CMakeLists.txt b/Encodings/Compiler/CMakeLists.txt index 1d8b959ec..97eecfee4 100644 --- a/Encodings/Compiler/CMakeLists.txt +++ b/Encodings/Compiler/CMakeLists.txt @@ -1,19 +1,19 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) -add_executable(EncodingsCompiler ${SRCS} ) +add_executable(EncodingsCompiler ${SRCS}) set_target_properties(EncodingsCompiler - PROPERTIES - OUTPUT_NAME tec - ) + PROPERTIES + OUTPUT_NAME tec +) target_link_libraries(EncodingsCompiler PUBLIC Poco::Net Poco::Util) install( - TARGETS EncodingsCompiler EXPORT "EncodingsCompilerTargets" - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + TARGETS EncodingsCompiler EXPORT "EncodingsCompilerTargets" + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin + INCLUDES DESTINATION include ) diff --git a/Encodings/testsuite/CMakeLists.txt b/Encodings/testsuite/CMakeLists.txt index 8d7abf38b..7f68ab71f 100644 --- a/Encodings/testsuite/CMakeLists.txt +++ b/Encodings/testsuite/CMakeLists.txt @@ -1,26 +1,33 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Encodings-testrunner ${TEST_SRCS} ) +add_executable(Encodings-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Encodings WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Encodings-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Encodings + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -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 -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Encodings PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME Encodings + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND Encodings-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Encodings PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(Encodings-testrunner PUBLIC Poco::Encodings CppUnit) diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt index 046841d5a..6b276bef5 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt @@ -1,23 +1,23 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Platform Specific -POCO_SOURCES_AUTO_PLAT( SRCS UNIX src/SyslogChannel.cpp ) -POCO_HEADERS_AUTO( SRCS include/Poco/SyslogChannel.h ) +POCO_SOURCES_AUTO_PLAT(SRCS UNIX src/SyslogChannel.cpp) +POCO_HEADERS_AUTO(SRCS include/Poco/SyslogChannel.h) # For Windows CE we need to disable these if(WINCE) -POCO_SOURCES_AUTO_PLAT( SRCS OFF +POCO_SOURCES_AUTO_PLAT(SRCS OFF src/WindowsConsoleChannel.cpp src/EventLogChannel.cpp ) else() -POCO_SOURCES_AUTO_PLAT( SRCS WIN32 +POCO_SOURCES_AUTO_PLAT(SRCS WIN32 src/WindowsConsoleChannel.cpp src/EventLogChannel.cpp ) @@ -25,28 +25,28 @@ endif() # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() # Messages -POCO_MESSAGES( SRCS Logging src/pocomsg.mc) +POCO_MESSAGES(SRCS Logging src/pocomsg.mc) # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found -if (POCO_UNBUNDLED) +if(POCO_UNBUNDLED) find_package(PCRE REQUIRED) find_package(ZLIB REQUIRED) #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library - POCO_SOURCES( SRCS RegExp + POCO_SOURCES(SRCS RegExp src/pcre_ucd.c src/pcre_tables.c ) else() # pcre - POCO_SOURCES( SRCS pcre + POCO_SOURCES(SRCS pcre src/pcre_config.c src/pcre_byte_order.c src/pcre_chartables.c @@ -71,12 +71,12 @@ else() ) # zlib - POCO_HEADERS( SRCS zlib + POCO_HEADERS(SRCS zlib include/Poco/zconf.h include/Poco/zlib.h ) - POCO_SOURCES( SRCS zlib + POCO_SOURCES(SRCS zlib src/adler32.c src/compress.c src/crc32.c @@ -88,7 +88,7 @@ else() src/trees.c src/zutil.c ) -endif (POCO_UNBUNDLED) +endif(POCO_UNBUNDLED) add_library(Foundation ${SRCS}) @@ -98,41 +98,41 @@ set_target_properties(Foundation VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoFoundation DEFINE_SYMBOL Foundation_EXPORTS - ) +) -if (POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) - target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) -endif (POCO_UNBUNDLED) +if(POCO_UNBUNDLED) + target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) + target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) +endif(POCO_UNBUNDLED) target_include_directories(Foundation PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) +) target_compile_definitions(Foundation - PUBLIC - $<$:_DEBUG> - $<$:POCO_DISABLE_CPP14> - $<$>:POCO_ENABLE_CPP14> - $<$:POCO_DISABLE_CPP11> - $<$>:POCO_ENABLE_CPP11> + PUBLIC + $<$:_DEBUG> + $<$:POCO_DISABLE_CPP14> + $<$>:POCO_ENABLE_CPP14> + $<$:POCO_DISABLE_CPP11> + $<$>:POCO_ENABLE_CPP11> ) target_compile_features(Foundation - PUBLIC - $<$>:cxx_defaulted_move_initializers> + PUBLIC + $<$>:cxx_defaulted_move_initializers> ) if(NOT DISABLE_CPP14 AND CMAKE_VERSION VERSION_GREATER "3.8") - target_compile_features(Foundation PUBLIC cxx_std_14) + target_compile_features(Foundation PUBLIC cxx_std_14) endif() if(NOT BUILD_SHARED_LIBS) - target_compile_definitions(Foundation - PUBLIC - POCO_STATIC - ) + target_compile_definitions(Foundation + PUBLIC + POCO_STATIC + ) endif() if(WIN32) @@ -140,56 +140,56 @@ if(WIN32) target_link_libraries(Foundation PUBLIC iphlpapi) endif() -if (CYGWIN) - target_compile_definitions(Foundation PUBLIC POCO_NO_FPENVIRONMENT POCO_NO_WSTRING _XOPEN_SOURCE=500 __BSD_VISIBLE) +if(CYGWIN) + target_compile_definitions(Foundation PUBLIC POCO_NO_FPENVIRONMENT POCO_NO_WSTRING _XOPEN_SOURCE=500 __BSD_VISIBLE) else() - if (UNIX AND NOT ANDROID ) - target_compile_definitions(Foundation PUBLIC POCO_OS_FAMILY_UNIX) - if (APPLE) - target_compile_definitions(Foundation PUBLIC POCO_HAVE_IPv6 POCO_NO_STAT64) - target_link_libraries(Foundation PUBLIC ${CMAKE_DL_LIBS}) - else() - target_compile_definitions(Foundation PUBLIC _REENTRANT _THREAD_SAFE _LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64) - if (QNX) - target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL) - target_link_libraries(Foundation PUBLIC m socket) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") - target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL) - target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "AIX") - target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_POLL) - target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt) + if(UNIX AND NOT ANDROID) + target_compile_definitions(Foundation PUBLIC POCO_OS_FAMILY_UNIX) + if(APPLE) + target_compile_definitions(Foundation PUBLIC POCO_HAVE_IPv6 POCO_NO_STAT64) + target_link_libraries(Foundation PUBLIC ${CMAKE_DL_LIBS}) else() - target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_EPOLL) - target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt) - endif() - endif (APPLE) - endif(UNIX AND NOT ANDROID ) -endif (CYGWIN) + target_compile_definitions(Foundation PUBLIC _REENTRANT _THREAD_SAFE _LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64) + if(QNX) + target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL) + target_link_libraries(Foundation PUBLIC m socket) + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") + target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL) + target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt) + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "AIX") + target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_POLL) + target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt) + else() + target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_EPOLL) + target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt) + endif() + endif(APPLE) + endif(UNIX AND NOT ANDROID) +endif(CYGWIN) -if (CMAKE_SYSTEM MATCHES "SunOS") - target_compile_definitions(Foundation - PUBLIC - POCO_OS_FAMILY_UNIX - _XOPEN_SOURCE=500 - _REENTRANT - _THREAD_SAFE - _LARGEFILE64_SOURCE - _FILE_OFFSET_BITS=64 +if(CMAKE_SYSTEM MATCHES "SunOS") + target_compile_definitions(Foundation + PUBLIC + POCO_OS_FAMILY_UNIX + _XOPEN_SOURCE=500 + _REENTRANT + _THREAD_SAFE + _LARGEFILE64_SOURCE + _FILE_OFFSET_BITS=64 ) - target_link_libraries(Foundation PUBLIC pthread socket xnet nsl resolv rt ${CMAKE_DL_LIBS}) + target_link_libraries(Foundation PUBLIC pthread socket xnet nsl resolv rt ${CMAKE_DL_LIBS}) endif() if(CMAKE_COMPILER_IS_MINGW) - target_compile_definitions(Foundation - PUBLIC - WC_NO_BEST_FIT_CHARS=0x400 - POCO_WIN32_UTF8 - _WIN32 - MINGW32 - WINVER=0x500 - ODBCVER=0x0300 - POCO_THREAD_STACK_SIZE + target_compile_definitions(Foundation + PUBLIC + WC_NO_BEST_FIT_CHARS=0x400 + POCO_WIN32_UTF8 + _WIN32 + MINGW32 + WINVER=0x500 + ODBCVER=0x0300 + POCO_THREAD_STACK_SIZE ) endif() @@ -200,19 +200,19 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") endif() # iOS -if (IOS) - target_compile_definitions(Foundation - PUBLIC - POCO_HAVE_IPv6 - POCO_NO_FPENVIRONMENT - POCO_NO_STAT64 - POCO_NO_SHAREDLIBS - POCO_NO_NET_IFTYPES +if(IOS) + target_compile_definitions(Foundation + PUBLIC + POCO_HAVE_IPv6 + POCO_NO_FPENVIRONMENT + POCO_NO_STAT64 + POCO_NO_SHAREDLIBS + POCO_NO_NET_IFTYPES ) endif() #Android -if (ANDROID) +if(ANDROID) target_compile_definitions(Foundation PUBLIC POCO_NO_FPENVIRONMENT @@ -225,11 +225,10 @@ endif() POCO_INSTALL(Foundation) POCO_GENERATE_PACKAGE(Foundation) -if (ENABLE_TESTS) +if(ENABLE_TESTS) if(NOT BUILD_SHARED_LIBS) - set_property(TARGET Foundation PROPERTY POSITION_INDEPENDENT_CODE ON) # This is needed to build TestLibrary.so as shared. + set_property(TARGET Foundation PROPERTY POSITION_INDEPENDENT_CODE ON) # This is needed to build TestLibrary.so as shared. endif() add_subdirectory(samples) add_subdirectory(testsuite) -endif () - +endif() diff --git a/Foundation/Foundation_vs140.vcxproj b/Foundation/Foundation_vs140.vcxproj index 54b76287a..6a14ebcff 100644 --- a/Foundation/Foundation_vs140.vcxproj +++ b/Foundation/Foundation_vs140.vcxproj @@ -630,20 +630,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -674,20 +660,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -784,20 +756,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -917,20 +875,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -999,20 +943,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1042,20 +972,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1094,20 +1010,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1205,20 +1107,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1329,20 +1217,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1612,7 +1486,6 @@ - @@ -1625,7 +1498,6 @@ - @@ -1651,7 +1523,6 @@ - @@ -1688,7 +1559,6 @@ - @@ -1709,11 +1579,9 @@ - - @@ -1735,7 +1603,6 @@ - @@ -1756,7 +1623,6 @@ - @@ -1781,7 +1647,6 @@ - diff --git a/Foundation/Foundation_vs140.vcxproj.filters b/Foundation/Foundation_vs140.vcxproj.filters index 63068d883..c13fe7482 100644 --- a/Foundation/Foundation_vs140.vcxproj.filters +++ b/Foundation/Foundation_vs140.vcxproj.filters @@ -216,9 +216,6 @@ Core\Source Files - - Core\Source Files - Core\Source Files @@ -486,9 +483,6 @@ SharedLibrary\Source Files - - SharedLibrary\Source Files - SharedLibrary\Source Files @@ -594,9 +588,6 @@ Logging\Source Files - - Logging\Source Files - Logging\Source Files @@ -666,9 +657,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -681,9 +669,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -696,9 +681,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -711,9 +693,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -723,9 +702,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -753,9 +729,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -965,9 +938,6 @@ Core\Header Files - - Core\Header Files - Core\Header Files @@ -1349,9 +1319,6 @@ SharedLibrary\Header Files - - SharedLibrary\Header Files - SharedLibrary\Header Files @@ -1406,9 +1373,6 @@ Logging\Header Files - - Logging\Header Files - Logging\Header Files @@ -1487,9 +1451,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1502,9 +1463,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1517,9 +1475,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1532,9 +1487,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files @@ -1544,9 +1496,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files @@ -1574,9 +1523,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files diff --git a/Foundation/Foundation_vs150.vcxproj b/Foundation/Foundation_vs150.vcxproj index b5865f5fd..30fd738c8 100644 --- a/Foundation/Foundation_vs150.vcxproj +++ b/Foundation/Foundation_vs150.vcxproj @@ -630,20 +630,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -674,20 +660,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -784,20 +756,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -917,20 +875,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -999,20 +943,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1042,20 +972,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1094,20 +1010,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1205,20 +1107,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1329,20 +1217,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1612,7 +1486,6 @@ - @@ -1625,7 +1498,6 @@ - @@ -1651,7 +1523,6 @@ - @@ -1688,7 +1559,6 @@ - @@ -1709,11 +1579,9 @@ - - @@ -1735,7 +1603,6 @@ - @@ -1756,7 +1623,6 @@ - @@ -1781,7 +1647,6 @@ - diff --git a/Foundation/Foundation_vs150.vcxproj.filters b/Foundation/Foundation_vs150.vcxproj.filters index 63068d883..c13fe7482 100644 --- a/Foundation/Foundation_vs150.vcxproj.filters +++ b/Foundation/Foundation_vs150.vcxproj.filters @@ -216,9 +216,6 @@ Core\Source Files - - Core\Source Files - Core\Source Files @@ -486,9 +483,6 @@ SharedLibrary\Source Files - - SharedLibrary\Source Files - SharedLibrary\Source Files @@ -594,9 +588,6 @@ Logging\Source Files - - Logging\Source Files - Logging\Source Files @@ -666,9 +657,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -681,9 +669,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -696,9 +681,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -711,9 +693,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -723,9 +702,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -753,9 +729,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -965,9 +938,6 @@ Core\Header Files - - Core\Header Files - Core\Header Files @@ -1349,9 +1319,6 @@ SharedLibrary\Header Files - - SharedLibrary\Header Files - SharedLibrary\Header Files @@ -1406,9 +1373,6 @@ Logging\Header Files - - Logging\Header Files - Logging\Header Files @@ -1487,9 +1451,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1502,9 +1463,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1517,9 +1475,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1532,9 +1487,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files @@ -1544,9 +1496,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files @@ -1574,9 +1523,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files diff --git a/Foundation/Foundation_vs160.vcxproj b/Foundation/Foundation_vs160.vcxproj index c7411be45..a69d0c9e6 100644 --- a/Foundation/Foundation_vs160.vcxproj +++ b/Foundation/Foundation_vs160.vcxproj @@ -630,20 +630,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -674,20 +660,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -784,20 +756,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -917,20 +875,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -999,20 +943,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1042,20 +972,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1094,20 +1010,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1205,20 +1107,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1329,20 +1217,6 @@ true true - - true - true - true - true - true - true - true - true - true - true - true - true - true true @@ -1612,7 +1486,6 @@ - @@ -1625,7 +1498,6 @@ - @@ -1651,7 +1523,6 @@ - @@ -1688,7 +1559,6 @@ - @@ -1709,11 +1579,9 @@ - - @@ -1735,7 +1603,6 @@ - @@ -1756,7 +1623,6 @@ - @@ -1781,7 +1647,6 @@ - diff --git a/Foundation/Foundation_vs160.vcxproj.filters b/Foundation/Foundation_vs160.vcxproj.filters index 63068d883..c13fe7482 100644 --- a/Foundation/Foundation_vs160.vcxproj.filters +++ b/Foundation/Foundation_vs160.vcxproj.filters @@ -216,9 +216,6 @@ Core\Source Files - - Core\Source Files - Core\Source Files @@ -486,9 +483,6 @@ SharedLibrary\Source Files - - SharedLibrary\Source Files - SharedLibrary\Source Files @@ -594,9 +588,6 @@ Logging\Source Files - - Logging\Source Files - Logging\Source Files @@ -666,9 +657,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -681,9 +669,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -696,9 +681,6 @@ Filesystem\Source Files - - Filesystem\Source Files - Filesystem\Source Files @@ -711,9 +693,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -723,9 +702,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -753,9 +729,6 @@ Processes\Source Files - - Processes\Source Files - Processes\Source Files @@ -965,9 +938,6 @@ Core\Header Files - - Core\Header Files - Core\Header Files @@ -1349,9 +1319,6 @@ SharedLibrary\Header Files - - SharedLibrary\Header Files - SharedLibrary\Header Files @@ -1406,9 +1373,6 @@ Logging\Header Files - - Logging\Header Files - Logging\Header Files @@ -1487,9 +1451,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1502,9 +1463,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1517,9 +1475,6 @@ Filesystem\Header Files - - Filesystem\Header Files - Filesystem\Header Files @@ -1532,9 +1487,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files @@ -1544,9 +1496,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files @@ -1574,9 +1523,6 @@ Processes\Header Files - - Processes\Header Files - Processes\Header Files diff --git a/Foundation/cmake/PocoFoundationConfig.cmake b/Foundation/cmake/PocoFoundationConfig.cmake index fac887655..46c2d3fc0 100644 --- a/Foundation/cmake/PocoFoundationConfig.cmake +++ b/Foundation/cmake/PocoFoundationConfig.cmake @@ -1,8 +1,8 @@ if(@POCO_UNBUNDLED@) - include(CMakeFindDependencyMacro) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") - find_dependency(ZLIB REQUIRED) - find_dependency(PCRE REQUIRED) + include(CMakeFindDependencyMacro) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + find_dependency(ZLIB REQUIRED) + find_dependency(PCRE REQUIRED) endif() include("${CMAKE_CURRENT_LIST_DIR}/PocoFoundationTargets.cmake") diff --git a/Foundation/include/Poco/Any.h b/Foundation/include/Poco/Any.h index 30181bc2a..ba6b71433 100644 --- a/Foundation/include/Poco/Any.h +++ b/Foundation/include/Poco/Any.h @@ -45,8 +45,8 @@ template union Placeholder /// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small /// object optimization, when enabled). - /// - /// If Holder fits into POCO_SMALL_OBJECT_SIZE bytes of storage, + /// + /// If Holder fits into POCO_SMALL_OBJECT_SIZE bytes of storage, /// it will be placement-new-allocated into the local buffer /// (i.e. there will be no heap-allocation). The local buffer size is one byte /// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating @@ -91,7 +91,7 @@ public: private: #endif typedef typename std::aligned_storage::type AlignerType; - + PlaceholderT* pHolder; mutable char holder[SizeV + 1]; AlignerType aligner; @@ -110,8 +110,8 @@ template union Placeholder /// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small /// object optimization, when enabled). - /// - /// If Holder fits into POCO_SMALL_OBJECT_SIZE bytes of storage, + /// + /// If Holder fits into POCO_SMALL_OBJECT_SIZE bytes of storage, /// it will be placement-new-allocated into the local buffer /// (i.e. there will be no heap-allocation). The local buffer size is one byte /// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating @@ -131,7 +131,7 @@ public: #if !defined(POCO_MSVC_VERSION) || (defined(POCO_MSVC_VERSION) && (POCO_MSVC_VERSION > 80)) private: #endif - + PlaceholderT* pHolder; friend class Any; @@ -167,8 +167,8 @@ public: Any(const ValueType & value) /// Creates an any which stores the init parameter inside. /// - /// Example: - /// Any a(13); + /// Example: + /// Any a(13); /// Any a(string("12345")); { construct(value); @@ -196,7 +196,7 @@ public: Any& swap(Any& other) /// Swaps the content of the two Anys. - /// + /// /// When small object optimization is enabled, swap only /// has no-throw guarantee when both (*this and other) /// objects are allocated on the heap. @@ -230,14 +230,14 @@ public: Any& operator = (const ValueType& rhs) /// Assignment operator for all types != Any. /// - /// Example: - /// Any a = 13; + /// Example: + /// Any a = 13; /// Any a = string("12345"); { construct(rhs); return *this; } - + Any& operator = (const Any& rhs) /// Assignment operator for Any. { @@ -248,14 +248,14 @@ public: return *this; } - + bool empty() const /// Returns true if the Any is empty. { char buf[POCO_SMALL_OBJECT_SIZE] = { 0 }; return 0 == std::memcmp(_valueHolder.holder, buf, POCO_SMALL_OBJECT_SIZE); } - + const std::type_info & type() const /// Returns the type information of the stored content. /// If the Any is empty typeid(void) is returned. @@ -335,7 +335,7 @@ private: else _valueHolder.erase(); } - + void destruct() { content()->~ValueHolder(); @@ -357,8 +357,8 @@ private: _pHolder(new Holder(value)) /// Creates an any which stores the init parameter inside. /// - /// Example: - /// Any a(13); + /// Example: + /// Any a(13); /// Any a(string("12345")); { } @@ -385,8 +385,8 @@ private: Any& operator = (const ValueType& rhs) /// Assignment operator for all types != Any. /// - /// Example: - /// Any a = 13; + /// Example: + /// Any a = 13; /// Any a = string("12345"); { Any(rhs).swap(*this); @@ -428,7 +428,7 @@ private: template class Holder: public ValueHolder { - public: + public: Holder(const ValueType& value): _held(value) { @@ -480,9 +480,9 @@ private: template ValueType* AnyCast(Any* operand) /// AnyCast operator used to extract the ValueType from an Any*. Will return a pointer - /// to the stored value. + /// to the stored value. /// - /// Example Usage: + /// Example Usage: /// MyType* pTmp = AnyCast(pAny). /// Will return NULL if the cast fails, i.e. types don't match. { @@ -495,7 +495,7 @@ ValueType* AnyCast(Any* operand) template const ValueType* AnyCast(const Any* operand) /// AnyCast operator used to extract a const ValueType pointer from an const Any*. Will return a const pointer - /// to the stored value. + /// to the stored value. /// /// Example Usage: /// const MyType* pTmp = AnyCast(pAny). @@ -509,7 +509,7 @@ template ValueType AnyCast(Any& operand) /// AnyCast operator used to extract a copy of the ValueType from an Any&. /// - /// Example Usage: + /// Example Usage: /// MyType tmp = AnyCast(anAny). /// Will throw a BadCastException if the cast fails. /// Do not use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ... @@ -540,7 +540,7 @@ template ValueType AnyCast(const Any& operand) /// AnyCast operator used to extract a copy of the ValueType from an const Any&. /// - /// Example Usage: + /// Example Usage: /// MyType tmp = AnyCast(anAny). /// Will throw a BadCastException if the cast fails. /// Do not use an AnyCast in combination with references, i.e. MyType& tmp = ... or const MyType& = ... @@ -555,20 +555,24 @@ ValueType AnyCast(const Any& operand) template const ValueType& RefAnyCast(const Any & operand) - /// AnyCast operator used to return a const reference to the internal data. + /// AnyCast operator used to return a const reference to the internal data. /// - /// Example Usage: + /// Example Usage: /// const MyType& tmp = RefAnyCast(anAny); { ValueType* result = AnyCast(const_cast(&operand)); - std::string s = "RefAnyCast: Failed to convert between Any types "; - if (operand._pHolder) + if (!result) { - s.append(1, '('); - s.append(operand._pHolder->type().name()); - s.append(" => "); - s.append(typeid(ValueType).name()); - s.append(1, ')'); + std::string s = "RefAnyCast: Failed to convert between Any types "; + if (operand._pHolder) + { + s.append(1, '('); + s.append(operand._pHolder->type().name()); + s.append(" => "); + s.append(typeid(ValueType).name()); + s.append(1, ')'); + } + throw BadCastException(s); } return *result; } @@ -578,7 +582,7 @@ template ValueType& RefAnyCast(Any& operand) /// AnyCast operator used to return a reference to the internal data. /// - /// Example Usage: + /// Example Usage: /// MyType& tmp = RefAnyCast(anAny); { ValueType* result = AnyCast(&operand); diff --git a/Foundation/include/Poco/DirectoryIterator_WIN32.h b/Foundation/include/Poco/DirectoryIterator_WIN32.h deleted file mode 100644 index 068cac367..000000000 --- a/Foundation/include/Poco/DirectoryIterator_WIN32.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// DirectoryIterator_WIN32.h -// -// Library: Foundation -// Package: Filesystem -// Module: DirectoryIterator -// -// Definition of the DirectoryIteratorImpl class for WIN32. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_DirectoryIterator_WIN32_INCLUDED -#define Foundation_DirectoryIterator_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -class Foundation_API DirectoryIteratorImpl -{ -public: - DirectoryIteratorImpl(const std::string& path); - ~DirectoryIteratorImpl(); - - void duplicate(); - void release(); - - const std::string& get() const; - const std::string& next(); - -private: - HANDLE _fh; - WIN32_FIND_DATA _fd; - std::string _current; - int _rc; -}; - - -// -// inlines -// -const std::string& DirectoryIteratorImpl::get() const -{ - return _current; -} - - -inline void DirectoryIteratorImpl::duplicate() -{ - ++_rc; -} - - -inline void DirectoryIteratorImpl::release() -{ - if (--_rc == 0) - delete this; -} - - -} // namespace Poco - - -#endif // Foundation_DirectoryIterator_WIN32_INCLUDED diff --git a/Foundation/include/Poco/Environment_WIN32.h b/Foundation/include/Poco/Environment_WIN32.h deleted file mode 100644 index bfac7c590..000000000 --- a/Foundation/include/Poco/Environment_WIN32.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// Environment_WIN32.h -// -// Library: Foundation -// Package: Core -// Module: Environment -// -// Definition of the EnvironmentImpl class for WIN32. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_Environment_WIN32_INCLUDED -#define Foundation_Environment_WIN32_INCLUDED - - -#include "Poco/Foundation.h" - - -namespace Poco { - - -class Foundation_API EnvironmentImpl -{ -public: - typedef UInt8 NodeId[6]; /// Ethernet address. - - static std::string getImpl(const std::string& name); - static bool hasImpl(const std::string& name); - static void setImpl(const std::string& name, const std::string& value); - static std::string osNameImpl(); - static std::string osDisplayNameImpl(); - static std::string osVersionImpl(); - static std::string osArchitectureImpl(); - static std::string nodeNameImpl(); - static void nodeIdImpl(NodeId& id); - static unsigned processorCountImpl(); -}; - - -} // namespace Poco - - -#endif // Foundation_Environment_WIN32_INCLUDED diff --git a/Foundation/include/Poco/File_WIN32.h b/Foundation/include/Poco/File_WIN32.h deleted file mode 100644 index b3aa00085..000000000 --- a/Foundation/include/Poco/File_WIN32.h +++ /dev/null @@ -1,92 +0,0 @@ -// -// File_WIN32.h -// -// Library: Foundation -// Package: Filesystem -// Module: File -// -// Definition of the FileImpl class for WIN32. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_File_WIN32_INCLUDED -#define Foundation_File_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/Timestamp.h" - - -namespace Poco { - - -class Foundation_API FileImpl -{ -protected: - enum Options - { - OPT_FAIL_ON_OVERWRITE_IMPL = 0x01 - }; - - typedef UInt64 FileSizeImpl; - - FileImpl(); - FileImpl(const std::string& path); - virtual ~FileImpl(); - void swapImpl(FileImpl& file); - void setPathImpl(const std::string& path); - const std::string& getPathImpl() const; - bool existsImpl() const; - bool canReadImpl() const; - bool canWriteImpl() const; - bool canExecuteImpl() const; - bool isFileImpl() const; - bool isDirectoryImpl() const; - bool isLinkImpl() const; - bool isDeviceImpl() const; - bool isHiddenImpl() const; - Timestamp createdImpl() const; - Timestamp getLastModifiedImpl() const; - void setLastModifiedImpl(const Timestamp& ts); - FileSizeImpl getSizeImpl() const; - void setSizeImpl(FileSizeImpl size); - void setWriteableImpl(bool flag = true); - void setExecutableImpl(bool flag = true); - void copyToImpl(const std::string& path, int options = 0) const; - void renameToImpl(const std::string& path, int options = 0); - void linkToImpl(const std::string& path, int type) const; - void removeImpl(); - bool createFileImpl(); - bool createDirectoryImpl(); - FileSizeImpl totalSpaceImpl() const; - FileSizeImpl usableSpaceImpl() const; - FileSizeImpl freeSpaceImpl() const; - static void handleLastErrorImpl(const std::string& path); - -private: - std::string _path; - - friend class FileHandle; - friend class DirectoryIteratorImpl; - friend class WindowsDirectoryWatcherStrategy; -}; - - -// -// inlines -// -inline const std::string& FileImpl::getPathImpl() const -{ - return _path; -} - - -} // namespace Poco - - -#endif // Foundation_File_WIN32_INCLUDED diff --git a/Foundation/include/Poco/LogFile_WIN32.h b/Foundation/include/Poco/LogFile_WIN32.h deleted file mode 100644 index ce2ff6cb0..000000000 --- a/Foundation/include/Poco/LogFile_WIN32.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// LogFile_WIN32.h -// -// Library: Foundation -// Package: Logging -// Module: LogFile -// -// Definition of the LogFileImpl class using the Windows file APIs. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_LogFile_WIN32_INCLUDED -#define Foundation_LogFile_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/Timestamp.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -class Foundation_API LogFileImpl - /// The implementation of LogFile for Windows. - /// The native filesystem APIs are used for - /// total control over locking behavior. -{ -public: - LogFileImpl(const std::string& path); - ~LogFileImpl(); - void writeImpl(const std::string& text, bool flush); - UInt64 sizeImpl() const; - Timestamp creationDateImpl() const; - const std::string& pathImpl() const; - -private: - void createFile(); - - std::string _path; - HANDLE _hFile; - Timestamp _creationDate; -}; - - -} // namespace Poco - - -#endif // Foundation_LogFile_WIN32_INCLUDED diff --git a/Foundation/include/Poco/Logger.h b/Foundation/include/Poco/Logger.h index 0c9cf21c2..0d7385b0b 100644 --- a/Foundation/include/Poco/Logger.h +++ b/Foundation/include/Poco/Logger.h @@ -73,7 +73,7 @@ class Foundation_API Logger: public Channel /// are used. The macros also add the source file path and line /// number into the log message so that it is available to formatters. /// Variants of these macros that allow message formatting with Poco::format() - /// are also available. + /// are also available. /// /// Examples: /// poco_warning(logger, "This is a warning"); @@ -88,20 +88,20 @@ public: void setChannel(Channel::Ptr pChannel); /// Attaches the given Channel to the Logger. - + Channel::Ptr getChannel() const; /// Returns the Channel attached to the logger. - + void setLevel(int level); /// Sets the Logger's log level. /// /// See Message::Priority for valid log levels. /// Setting the log level to zero turns off /// logging for that Logger. - + int getLevel() const; /// Returns the Logger's log level. - + void setLevel(const std::string& level); /// Sets the Logger's log level using a symbolic value. /// @@ -126,17 +126,17 @@ public: void log(const Message& msg); /// Logs the given message if its priority is /// greater than or equal to the Logger's log level. - + void log(const Exception& exc); - /// Logs the given exception with priority PRIO_ERROR. + /// Logs the given exception with priority PRIO_ERROR. void log(const Exception& exc, const char* file, int line); - /// Logs the given exception with priority PRIO_ERROR. + /// Logs the given exception with priority PRIO_ERROR. /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. - + /// internally for performance reasons. + void fatal(const std::string& msg); /// If the Logger's log level is at least PRIO_FATAL, /// creates a Message with priority PRIO_FATAL @@ -151,10 +151,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void fatal(const std::string &fmt, T arg1, Args&&... args) + void fatal(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_FATAL); } @@ -173,10 +173,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void critical(const std::string &fmt, T arg1, Args&&... args) + void critical(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_CRITICAL); } @@ -195,10 +195,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void error(const std::string &fmt, T arg1, Args&&... args) + void error(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_ERROR); } @@ -217,10 +217,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void warning(const std::string &fmt, T arg1, Args&&... args) + void warning(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_WARNING); } @@ -239,10 +239,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void notice(const std::string &fmt, T arg1, Args&&... args) + void notice(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_NOTICE); } @@ -261,10 +261,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void information(const std::string &fmt, T arg1, Args&&... args) + void information(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_INFORMATION); } @@ -283,10 +283,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void debug(const std::string &fmt, T arg1, Args&&... args) + void debug(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_DEBUG); } @@ -305,10 +305,10 @@ public: /// /// File must be a static string, such as the value of /// the __FILE__ macro. The string is not copied - /// internally for performance reasons. + /// internally for performance reasons. template - void trace(const std::string &fmt, T arg1, Args&&... args) + void trace(const std::string& fmt, T arg1, Args&&... args) { log(Poco::format(fmt, arg1, std::forward(args)...), Message::PRIO_TRACE); } @@ -317,17 +317,17 @@ public: /// Logs the given message, followed by the data in buffer. /// /// The data in buffer is written in canonical hex+ASCII form: - /// Offset (4 bytes) in hexadecimal, followed by sixteen + /// Offset (4 bytes) in hexadecimal, followed by sixteen /// space-separated, two column, hexadecimal bytes, /// followed by the same sixteen bytes as ASCII characters. /// For bytes outside the range 32 .. 127, a dot is printed. bool is(int level) const; /// Returns true if at least the given log level is set. - + bool fatal() const; /// Returns true if the log level is at least PRIO_FATAL. - + bool critical() const; /// Returns true if the log level is at least PRIO_CRITICAL. @@ -353,18 +353,18 @@ public: /// Replaces all occurrences of $0 in fmt with the string given in arg and /// returns the result. To include a dollar sign in the result string, /// specify two dollar signs ($$) in the format string. - + static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1); /// Replaces all occurrences of $ in fmt with the string given in arg and /// returns the result. To include a dollar sign in the result string, /// specify two dollar signs ($$) in the format string. - static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2); + static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2); /// Replaces all occurrences of $ in fmt with the string given in arg and /// returns the result. To include a dollar sign in the result string, /// specify two dollar signs ($$) in the format string. - static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3); + static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3); /// Replaces all occurrences of $ in fmt with the string given in arg and /// returns the result. To include a dollar sign in the result string, /// specify two dollar signs ($$) in the format string. @@ -372,11 +372,11 @@ public: static void formatDump(std::string& message, const void* buffer, std::size_t length); /// Creates a hex-dump of the given buffer and appends it to the /// given message string. - + static void setLevel(const std::string& name, int level); /// Sets the given log level on all loggers that are /// descendants of the Logger with the given name. - + static void setChannel(const std::string& name, Channel::Ptr pChannel); /// Attaches the given Channel to all loggers that are /// descendants of the Logger with the given name. @@ -399,35 +399,35 @@ public: /// probably use get() instead. /// The only time this method should be used is during /// program initialization, when only one thread is running. - + static Logger& create(const std::string& name, Channel::Ptr pChannel, int level = Message::PRIO_INFORMATION); /// Creates and returns a reference to a Logger with the /// given name. The Logger's Channel and log level as set as /// specified. - + static Logger& root(); /// Returns a reference to the root logger, which is the ultimate /// ancestor of all Loggers. - + static Ptr has(const std::string& name); /// Returns a pointer to the Logger with the given name if it /// exists, or a null pointer otherwise. - + static void destroy(const std::string& name); /// Destroys the logger with the specified name. Does nothing /// if the logger is not found. /// /// After a logger has been destroyed, all references to it - /// become invalid. - + /// become invalid. + static void shutdown(); /// Shuts down the logging framework and releases all /// Loggers. - + static void names(std::vector& names); /// Fills the given vector with the names /// of all currently defined loggers. - + static int parseLevel(const std::string& level); /// Parses a symbolic log level from a string and /// returns the resulting numeric level. @@ -444,15 +444,15 @@ public: /// - trace /// /// The level is not case sensitive. - - static const std::string ROOT; /// The name of the root logger (""). - + + static const std::string ROOT; /// The name of the root logger (""). + protected: typedef std::map LoggerMap; Logger(const std::string& name, Channel::Ptr pChannel, int level); ~Logger(); - + void log(const std::string& text, Message::Priority prio); void log(const std::string& text, Message::Priority prio, const char* file, int line); @@ -467,7 +467,7 @@ private: Logger(); Logger(const Logger&); Logger& operator = (const Logger&); - + std::string _name; Channel::Ptr _pChannel; int _level; diff --git a/Foundation/include/Poco/NamedEvent_WIN32.h b/Foundation/include/Poco/NamedEvent_WIN32.h deleted file mode 100644 index 4d09f90a8..000000000 --- a/Foundation/include/Poco/NamedEvent_WIN32.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// NamedEvent_WIN32.h -// -// Library: Foundation -// Package: Processes -// Module: NamedEvent -// -// Definition of the NamedEventImpl class for Windows. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_NamedEvent_WIN32_INCLUDED -#define Foundation_NamedEvent_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -class Foundation_API NamedEventImpl -{ -protected: - NamedEventImpl(const std::string& name); - ~NamedEventImpl(); - void setImpl(); - void waitImpl(); - -private: - std::string _name; - HANDLE _event; -}; - - -} // namespace Poco - - -#endif // Foundation_NamedEvent_WIN32_INCLUDED diff --git a/Foundation/include/Poco/NamedMutex_WIN32.h b/Foundation/include/Poco/NamedMutex_WIN32.h deleted file mode 100644 index c43dd3534..000000000 --- a/Foundation/include/Poco/NamedMutex_WIN32.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// NamedMutex_WIN32.h -// -// Library: Foundation -// Package: Processes -// Module: NamedMutex -// -// Definition of the NamedMutexImpl class for Windows. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_NamedMutex_WIN32_INCLUDED -#define Foundation_NamedMutex_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -class Foundation_API NamedMutexImpl -{ -protected: - NamedMutexImpl(const std::string& name); - ~NamedMutexImpl(); - void lockImpl(); - bool tryLockImpl(); - void unlockImpl(); - -private: - std::string _name; - HANDLE _mutex; -}; - - -} // namespace Poco - - -#endif // Foundation_NamedMutex_WIN32_INCLUDED diff --git a/Foundation/include/Poco/Path_WIN32.h b/Foundation/include/Poco/Path_WIN32.h deleted file mode 100644 index 02a3a5b28..000000000 --- a/Foundation/include/Poco/Path_WIN32.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// Path_WIN32.h -// -// Library: Foundation -// Package: Filesystem -// Module: Path -// -// Definition of the PathImpl class for WIN32. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_Path_WIN32_INCLUDED -#define Foundation_Path_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include - - -namespace Poco { - - -class Foundation_API PathImpl -{ -public: - static std::string currentImpl(); - static std::string homeImpl(); - static std::string configHomeImpl(); - static std::string dataHomeImpl(); - static std::string cacheHomeImpl(); - static std::string tempHomeImpl(); - static std::string tempImpl(); - static std::string configImpl(); - static std::string nullImpl(); - static std::string systemImpl(); - static std::string expandImpl(const std::string& path); - static void listRootsImpl(std::vector& roots); -}; - - -} // namespace Poco - - -#endif // Foundation_Path_WIN32_INCLUDED diff --git a/Foundation/include/Poco/Process_WIN32.h b/Foundation/include/Poco/Process_WIN32.h deleted file mode 100644 index 90f5600b5..000000000 --- a/Foundation/include/Poco/Process_WIN32.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// Process_WIN32.h -// -// Library: Foundation -// Package: Processes -// Module: Process -// -// Definition of the ProcessImpl class for WIN32. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_Process_WIN32_INCLUDED -#define Foundation_Process_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/RefCountedObject.h" -#include -#include -#include "Poco/UnWindows.h" - - -namespace Poco { - - -class Pipe; - - -class Foundation_API ProcessHandleImpl: public RefCountedObject -{ -public: - ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); - ~ProcessHandleImpl(); - - UInt32 id() const; - HANDLE process() const; - int wait() const; - int tryWait() const; - void closeHandle(); - -private: - HANDLE _hProcess; - UInt32 _pid; - - ProcessHandleImpl(const ProcessHandleImpl&); - ProcessHandleImpl& operator = (const ProcessHandleImpl&); -}; - - -class Foundation_API ProcessImpl -{ -public: - typedef UInt32 PIDImpl; - typedef std::vector ArgsImpl; - typedef std::map EnvImpl; - - static PIDImpl idImpl(); - static void timesImpl(long& userTime, long& kernelTime); - static ProcessHandleImpl* launchImpl( - const std::string& command, - const ArgsImpl& args, - const std::string& initialDirectory, - Pipe* inPipe, - Pipe* outPipe, - Pipe* errPipe, - const EnvImpl& env); - static void killImpl(ProcessHandleImpl& handle); - static void killImpl(PIDImpl pid); - static bool isRunningImpl(const ProcessHandleImpl& handle); - static bool isRunningImpl(PIDImpl pid); - static void requestTerminationImpl(PIDImpl pid); - static std::string terminationEventName(PIDImpl pid); -}; - - -} // namespace Poco - - -#endif // Foundation_Process_WIN32_INCLUDED diff --git a/Foundation/include/Poco/Process_WIN32U.h b/Foundation/include/Poco/Process_WIN32U.h index dd62fbf4d..ffe920af3 100644 --- a/Foundation/include/Poco/Process_WIN32U.h +++ b/Foundation/include/Poco/Process_WIN32U.h @@ -75,6 +75,8 @@ public: static bool isRunningImpl(PIDImpl pid); static void requestTerminationImpl(PIDImpl pid); static std::string terminationEventName(PIDImpl pid); + static bool mustEscapeArg(const std::string& arg); + static std::string escapeArg(const std::string& arg); }; diff --git a/Foundation/include/Poco/SharedLibrary_WIN32.h b/Foundation/include/Poco/SharedLibrary_WIN32.h deleted file mode 100644 index 6b7fc2945..000000000 --- a/Foundation/include/Poco/SharedLibrary_WIN32.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// SharedLibrary_WIN32.h -// -// Library: Foundation -// Package: SharedLibrary -// Module: SharedLibrary -// -// Definition of the SharedLibraryImpl class for Win32. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_SharedLibrary_WIN32_INCLUDED -#define Foundation_SharedLibrary_WIN32_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/Mutex.h" - - -namespace Poco { - - -class Foundation_API SharedLibraryImpl -{ -protected: - SharedLibraryImpl(); - ~SharedLibraryImpl(); - void loadImpl(const std::string& path, int flags); - void unloadImpl(); - bool isLoadedImpl() const; - void* findSymbolImpl(const std::string& name); - const std::string& getPathImpl() const; - static std::string suffixImpl(); - static bool setSearchPathImpl(const std::string& path); - -private: - std::string _path; - void* _handle; - static FastMutex _mutex; -}; - - -} // namespace Poco - - -#endif // Foundation_SharedLibrary_WIN32_INCLUDED diff --git a/Foundation/samples/ActiveMethod/CMakeLists.txt b/Foundation/samples/ActiveMethod/CMakeLists.txt index 94596ea87..bcc4020dd 100644 --- a/Foundation/samples/ActiveMethod/CMakeLists.txt +++ b/Foundation/samples/ActiveMethod/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(ActiveMethod src/ActiveMethod.cpp) -target_link_libraries(ActiveMethod PUBLIC Poco::Foundation ) +target_link_libraries(ActiveMethod PUBLIC Poco::Foundation) diff --git a/Foundation/samples/Activity/CMakeLists.txt b/Foundation/samples/Activity/CMakeLists.txt index 9c2475ead..0ed33a6e3 100644 --- a/Foundation/samples/Activity/CMakeLists.txt +++ b/Foundation/samples/Activity/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(Activity src/Activity.cpp) -target_link_libraries(Activity PUBLIC Poco::Foundation ) +target_link_libraries(Activity PUBLIC Poco::Foundation) diff --git a/Foundation/samples/BinaryReaderWriter/CMakeLists.txt b/Foundation/samples/BinaryReaderWriter/CMakeLists.txt index 0754edc7d..bb5305fde 100644 --- a/Foundation/samples/BinaryReaderWriter/CMakeLists.txt +++ b/Foundation/samples/BinaryReaderWriter/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(BinaryReaderWriter src/BinaryReaderWriter.cpp) -target_link_libraries(BinaryReaderWriter PUBLIC Poco::Foundation ) +target_link_libraries(BinaryReaderWriter PUBLIC Poco::Foundation) diff --git a/Foundation/samples/LineEndingConverter/CMakeLists.txt b/Foundation/samples/LineEndingConverter/CMakeLists.txt index e584f7ed3..ec416d7a7 100644 --- a/Foundation/samples/LineEndingConverter/CMakeLists.txt +++ b/Foundation/samples/LineEndingConverter/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(LineEndingConverter src/LineEndingConverter.cpp) -target_link_libraries(LineEndingConverter PUBLIC Poco::Foundation ) +target_link_libraries(LineEndingConverter PUBLIC Poco::Foundation) diff --git a/Foundation/samples/LogRotation/CMakeLists.txt b/Foundation/samples/LogRotation/CMakeLists.txt index 72ed3b84e..33efcf8c4 100644 --- a/Foundation/samples/LogRotation/CMakeLists.txt +++ b/Foundation/samples/LogRotation/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(LogRotation src/LogRotation.cpp) -target_link_libraries(LogRotation PUBLIC Poco::Foundation ) +target_link_libraries(LogRotation PUBLIC Poco::Foundation) diff --git a/Foundation/samples/Logger/CMakeLists.txt b/Foundation/samples/Logger/CMakeLists.txt index b58fa0af3..2bcab3abf 100644 --- a/Foundation/samples/Logger/CMakeLists.txt +++ b/Foundation/samples/Logger/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(Logger src/Logger.cpp) -target_link_libraries(Logger PUBLIC Poco::Foundation ) +target_link_libraries(Logger PUBLIC Poco::Foundation) diff --git a/Foundation/samples/NotificationQueue/CMakeLists.txt b/Foundation/samples/NotificationQueue/CMakeLists.txt index 3e72e97c2..d8356077d 100644 --- a/Foundation/samples/NotificationQueue/CMakeLists.txt +++ b/Foundation/samples/NotificationQueue/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(NotificationQueue src/NotificationQueue.cpp) -target_link_libraries(NotificationQueue PUBLIC Poco::Foundation ) +target_link_libraries(NotificationQueue PUBLIC Poco::Foundation) diff --git a/Foundation/samples/Timer/CMakeLists.txt b/Foundation/samples/Timer/CMakeLists.txt index 130bd1163..ee6509625 100644 --- a/Foundation/samples/Timer/CMakeLists.txt +++ b/Foundation/samples/Timer/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(Timer src/Timer.cpp) -target_link_libraries(Timer PUBLIC Poco::Foundation ) +target_link_libraries(Timer PUBLIC Poco::Foundation) diff --git a/Foundation/samples/URI/CMakeLists.txt b/Foundation/samples/URI/CMakeLists.txt index e31d42ff0..af1617376 100644 --- a/Foundation/samples/URI/CMakeLists.txt +++ b/Foundation/samples/URI/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(URI src/URI.cpp) -target_link_libraries(URI PUBLIC Poco::Foundation ) +target_link_libraries(URI PUBLIC Poco::Foundation) diff --git a/Foundation/samples/base64decode/CMakeLists.txt b/Foundation/samples/base64decode/CMakeLists.txt index 478acfd80..1ace98659 100644 --- a/Foundation/samples/base64decode/CMakeLists.txt +++ b/Foundation/samples/base64decode/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(base64decode src/base64decode.cpp) -target_link_libraries(base64decode PUBLIC Poco::Foundation ) +target_link_libraries(base64decode PUBLIC Poco::Foundation) diff --git a/Foundation/samples/base64encode/CMakeLists.txt b/Foundation/samples/base64encode/CMakeLists.txt index 340200aa2..78ead89ef 100644 --- a/Foundation/samples/base64encode/CMakeLists.txt +++ b/Foundation/samples/base64encode/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(base64encode src/base64encode.cpp) -target_link_libraries(base64encode PUBLIC Poco::Foundation ) +target_link_libraries(base64encode PUBLIC Poco::Foundation) diff --git a/Foundation/samples/deflate/CMakeLists.txt b/Foundation/samples/deflate/CMakeLists.txt index b399a55ca..52714b967 100644 --- a/Foundation/samples/deflate/CMakeLists.txt +++ b/Foundation/samples/deflate/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(deflate src/deflate.cpp) -target_link_libraries(deflate PUBLIC Poco::Foundation ) +target_link_libraries(deflate PUBLIC Poco::Foundation) diff --git a/Foundation/samples/dir/CMakeLists.txt b/Foundation/samples/dir/CMakeLists.txt index 27ada10b9..fda94ea45 100644 --- a/Foundation/samples/dir/CMakeLists.txt +++ b/Foundation/samples/dir/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(dir src/dir.cpp) -target_link_libraries(dir PUBLIC Poco::Foundation ) +target_link_libraries(dir PUBLIC Poco::Foundation) diff --git a/Foundation/samples/grep/CMakeLists.txt b/Foundation/samples/grep/CMakeLists.txt index 1cb4cce66..45c342565 100644 --- a/Foundation/samples/grep/CMakeLists.txt +++ b/Foundation/samples/grep/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(grep src/grep.cpp) -target_link_libraries(grep PUBLIC Poco::Foundation ) +target_link_libraries(grep PUBLIC Poco::Foundation) diff --git a/Foundation/samples/hmacmd5/CMakeLists.txt b/Foundation/samples/hmacmd5/CMakeLists.txt index d784ad36b..629d5b270 100644 --- a/Foundation/samples/hmacmd5/CMakeLists.txt +++ b/Foundation/samples/hmacmd5/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(hmacmd5 src/hmacmd5.cpp) -target_link_libraries(hmacmd5 PUBLIC Poco::Foundation ) +target_link_libraries(hmacmd5 PUBLIC Poco::Foundation) diff --git a/Foundation/samples/inflate/CMakeLists.txt b/Foundation/samples/inflate/CMakeLists.txt index dcae66a3b..c5eb8752f 100644 --- a/Foundation/samples/inflate/CMakeLists.txt +++ b/Foundation/samples/inflate/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(inflate src/inflate.cpp) -target_link_libraries(inflate PUBLIC Poco::Foundation ) +target_link_libraries(inflate PUBLIC Poco::Foundation) diff --git a/Foundation/samples/md5/CMakeLists.txt b/Foundation/samples/md5/CMakeLists.txt index 0063266d9..cca4aeeeb 100644 --- a/Foundation/samples/md5/CMakeLists.txt +++ b/Foundation/samples/md5/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(md5 src/md5.cpp) -target_link_libraries(md5 PUBLIC Poco::Foundation ) +target_link_libraries(md5 PUBLIC Poco::Foundation) diff --git a/Foundation/samples/uuidgen/CMakeLists.txt b/Foundation/samples/uuidgen/CMakeLists.txt index 40cc91ec9..62dcb19d4 100644 --- a/Foundation/samples/uuidgen/CMakeLists.txt +++ b/Foundation/samples/uuidgen/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(uuidgen src/uuidgen.cpp) -target_link_libraries(uuidgen PUBLIC Poco::Foundation ) +target_link_libraries(uuidgen PUBLIC Poco::Foundation) diff --git a/Foundation/src/DirectoryIterator_WIN32.cpp b/Foundation/src/DirectoryIterator_WIN32.cpp deleted file mode 100644 index e7ebfc859..000000000 --- a/Foundation/src/DirectoryIterator_WIN32.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// DirectoryIterator_WIN32.cpp -// -// Library: Foundation -// Package: Filesystem -// Module: DirectoryIterator -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/DirectoryIterator_WIN32.h" -#include "Poco/File_WIN32.h" -#include "Poco/Path.h" - - -namespace Poco { - - -DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVALID_HANDLE_VALUE), _rc(1) -{ - Path p(path); - p.makeDirectory(); - std::string findPath = p.toString(); - findPath.append("*"); - - _fh = FindFirstFile(findPath.c_str(), &_fd); - if (_fh == INVALID_HANDLE_VALUE) - { - if (GetLastError() != ERROR_NO_MORE_FILES) - File::handleLastError(path); - } - else - { - _current = _fd.cFileName; - if (_current == "." || _current == "..") - next(); - } -} - - -DirectoryIteratorImpl::~DirectoryIteratorImpl() -{ - if (_fh != INVALID_HANDLE_VALUE) - FindClose(_fh); -} - - -const std::string& DirectoryIteratorImpl::next() -{ - do - { - if (FindNextFile(_fh, &_fd) != 0) - _current = _fd.cFileName; - else - _current.clear(); - } - while (_current == "." || _current == ".."); - return _current; -} - - -} // namespace Poco diff --git a/Foundation/src/Environment_WIN32.cpp b/Foundation/src/Environment_WIN32.cpp deleted file mode 100644 index 62845fab0..000000000 --- a/Foundation/src/Environment_WIN32.cpp +++ /dev/null @@ -1,221 +0,0 @@ -// -// Environment_WIN32.cpp -// -// Library: Foundation -// Package: Core -// Module: Environment -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Environment_WIN32.h" -#include "Poco/Exception.h" -#include -#include -#include "Poco/UnWindows.h" -#include -#include -#include -#include - - -namespace Poco { - - -std::string EnvironmentImpl::getImpl(const std::string& name) -{ - DWORD len = GetEnvironmentVariableA(name.c_str(), 0, 0); - if (len == 0) throw NotFoundException(name); - char* buffer = new char[len]; - GetEnvironmentVariableA(name.c_str(), buffer, len); - std::string result(buffer); - delete [] buffer; - return result; -} - - -bool EnvironmentImpl::hasImpl(const std::string& name) -{ - DWORD len = GetEnvironmentVariableA(name.c_str(), 0, 0); - return len > 0; -} - - -void EnvironmentImpl::setImpl(const std::string& name, const std::string& value) -{ - if (SetEnvironmentVariableA(name.c_str(), value.c_str()) == 0) - { - std::string msg = "cannot set environment variable: "; - msg.append(name); - throw SystemException(msg); - } -} - - -std::string EnvironmentImpl::osNameImpl() -{ - OSVERSIONINFO vi; - vi.dwOSVersionInfoSize = sizeof(vi); - if (GetVersionEx(&vi) == 0) throw SystemException("Cannot get OS version information"); - switch (vi.dwPlatformId) - { - case VER_PLATFORM_WIN32s: - return "Windows 3.x"; - case VER_PLATFORM_WIN32_WINDOWS: - return vi.dwMinorVersion == 0 ? "Windows 95" : "Windows 98"; - case VER_PLATFORM_WIN32_NT: - return "Windows NT"; - default: - return "Unknown"; - } -} - - -std::string EnvironmentImpl::osDisplayNameImpl() -{ - OSVERSIONINFOEX vi; // OSVERSIONINFOEX is supported starting at Windows 2000 - vi.dwOSVersionInfoSize = sizeof(vi); - if (GetVersionEx((OSVERSIONINFO*) &vi) == 0) throw SystemException("Cannot get OS version information"); - switch (vi.dwMajorVersion) - { - case 10: - switch (vi.dwMinorVersion) - { - case 0: - return vi.wProductType == VER_NT_WORKSTATION ? "Windows 10" : "Windows Server 2016"; - } - case 6: - switch (vi.dwMinorVersion) - { - case 0: - return vi.wProductType == VER_NT_WORKSTATION ? "Windows Vista" : "Windows Server 2008"; - case 1: - return vi.wProductType == VER_NT_WORKSTATION ? "Windows 7" : "Windows Server 2008 R2"; - case 2: - return vi.wProductType == VER_NT_WORKSTATION ? "Windows 8" : "Windows Server 2012"; - case 3: - return vi.wProductType == VER_NT_WORKSTATION ? "Windows 8.1" : "Windows Server 2012 R2"; - default: - return "Unknown"; - } - case 5: - switch (vi.dwMinorVersion) - { - case 0: - return "Windows 2000"; - case 1: - return "Windows XP"; - case 2: - return "Windows Server 2003/Windows Server 2003 R2"; - default: - return "Unknown"; - } - default: - return "Unknown"; - } -} - - -std::string EnvironmentImpl::osVersionImpl() -{ - OSVERSIONINFO vi; - vi.dwOSVersionInfoSize = sizeof(vi); - if (GetVersionEx(&vi) == 0) throw SystemException("Cannot get OS version information"); - std::ostringstream str; - str << vi.dwMajorVersion << "." << vi.dwMinorVersion << " (Build " << (vi.dwBuildNumber & 0xFFFF); - if (vi.szCSDVersion[0]) str << ": " << vi.szCSDVersion; - str << ")"; - return str.str(); -} - - -std::string EnvironmentImpl::osArchitectureImpl() -{ - SYSTEM_INFO si; - GetSystemInfo(&si); - switch (si.wProcessorArchitecture) - { - case PROCESSOR_ARCHITECTURE_INTEL: - return "IA32"; - case PROCESSOR_ARCHITECTURE_MIPS: - return "MIPS"; - case PROCESSOR_ARCHITECTURE_ALPHA: - return "ALPHA"; - case PROCESSOR_ARCHITECTURE_PPC: - return "PPC"; - case PROCESSOR_ARCHITECTURE_IA64: - return "IA64"; -#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 - case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: - return "IA64/32"; -#endif -#ifdef PROCESSOR_ARCHITECTURE_AMD64 - case PROCESSOR_ARCHITECTURE_AMD64: - return "AMD64"; -#endif - default: - return "Unknown"; - } -} - - -std::string EnvironmentImpl::nodeNameImpl() -{ - char name[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD size = sizeof(name); - if (GetComputerNameA(name, &size) == 0) throw SystemException("Cannot get computer name"); - return std::string(name); -} - - -void EnvironmentImpl::nodeIdImpl(NodeId& id) -{ - std::memset(&id, 0, sizeof(id)); - - PIP_ADAPTER_INFO pAdapterInfo; - PIP_ADAPTER_INFO pAdapter = 0; - ULONG len = sizeof(IP_ADAPTER_INFO); - pAdapterInfo = reinterpret_cast(new char[len]); - // Make an initial call to GetAdaptersInfo to get - // the necessary size into len - DWORD rc = GetAdaptersInfo(pAdapterInfo, &len); - if (rc == ERROR_BUFFER_OVERFLOW) - { - delete [] reinterpret_cast(pAdapterInfo); - pAdapterInfo = reinterpret_cast(new char[len]); - } - else if (rc != ERROR_SUCCESS) - { - return; - } - if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR) - { - pAdapter = pAdapterInfo; - bool found = false; - while (pAdapter && !found) - { - if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id)) - { - found = true; - std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength); - } - pAdapter = pAdapter->Next; - } - } - delete [] reinterpret_cast(pAdapterInfo); -} - - -unsigned EnvironmentImpl::processorCountImpl() -{ - SYSTEM_INFO si; - GetSystemInfo(&si); - return si.dwNumberOfProcessors; -} - - -} // namespace Poco diff --git a/Foundation/src/File_WIN32.cpp b/Foundation/src/File_WIN32.cpp deleted file mode 100644 index 32b56ccf0..000000000 --- a/Foundation/src/File_WIN32.cpp +++ /dev/null @@ -1,471 +0,0 @@ -// -// File_WIN32.cpp -// -// Library: Foundation -// Package: Filesystem -// Module: File -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/File_WIN32.h" -#include "Poco/Exception.h" -#include "Poco/String.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -class FileHandle -{ -public: - FileHandle(const std::string& path, DWORD access, DWORD share, DWORD disp) - { - _h = CreateFileA(path.c_str(), access, share, 0, disp, 0, 0); - if (_h == INVALID_HANDLE_VALUE) - { - FileImpl::handleLastErrorImpl(path); - } - } - - ~FileHandle() - { - if (_h != INVALID_HANDLE_VALUE) CloseHandle(_h); - } - - HANDLE get() const - { - return _h; - } - -private: - HANDLE _h; -}; - - -FileImpl::FileImpl() -{ -} - - -FileImpl::FileImpl(const std::string& path): _path(path) -{ - std::string::size_type n = _path.size(); - if (n > 1 && (_path[n - 1] == '\\' || _path[n - 1] == '/') && !((n == 3 && _path[1]==':'))) - { - _path.resize(n - 1); - } -} - - -FileImpl::~FileImpl() -{ -} - - -void FileImpl::swapImpl(FileImpl& file) -{ - std::swap(_path, file._path); -} - - -void FileImpl::setPathImpl(const std::string& path) -{ - _path = path; - std::string::size_type n = _path.size(); - if (n > 1 && (_path[n - 1] == '\\' || _path[n - 1] == '/') && !((n == 3 && _path[1]==':'))) - { - _path.resize(n - 1); - } -} - - -bool FileImpl::existsImpl() const -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES) - { - switch (GetLastError()) - { - case ERROR_FILE_NOT_FOUND: - case ERROR_PATH_NOT_FOUND: - case ERROR_NOT_READY: - case ERROR_INVALID_DRIVE: - return false; - default: - handleLastErrorImpl(_path); - } - } - return true; -} - - -bool FileImpl::canReadImpl() const -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES) - { - switch (GetLastError()) - { - case ERROR_ACCESS_DENIED: - return false; - default: - handleLastErrorImpl(_path); - } - } - return true; -} - - -bool FileImpl::canWriteImpl() const -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES) - handleLastErrorImpl(_path); - return (attr & FILE_ATTRIBUTE_READONLY) == 0; -} - - -bool FileImpl::canExecuteImpl() const -{ - Path p(_path); - return icompare(p.getExtension(), "exe") == 0; -} - - -bool FileImpl::isFileImpl() const -{ - return !isDirectoryImpl() && !isDeviceImpl(); -} - - -bool FileImpl::isDirectoryImpl() const -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES) - handleLastErrorImpl(_path); - return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0; -} - - -bool FileImpl::isLinkImpl() const -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES) - handleLastErrorImpl(_path); - return (attr & FILE_ATTRIBUTE_DIRECTORY) == 0 && (attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0; -} - - - -bool FileImpl::isDeviceImpl() const -{ - return - _path.compare(0, 4, "\\\\.\\") == 0 || - icompare(_path, "CON") == 0 || - icompare(_path, "PRN") == 0 || - icompare(_path, "AUX") == 0 || - icompare(_path, "NUL") == 0 || - ( (icompare(_path, 0, 3, "LPT") == 0 || icompare(_path, 0, 3, "COM") == 0) && - _path.size() == 4 && - _path[3] > 0x30 && - isdigit(_path[3]) - ); -} - - -bool FileImpl::isHiddenImpl() const -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES) - handleLastErrorImpl(_path); - return (attr & FILE_ATTRIBUTE_HIDDEN) != 0; -} - - -Timestamp FileImpl::createdImpl() const -{ - poco_assert (!_path.empty()); - - WIN32_FILE_ATTRIBUTE_DATA fad; - if (GetFileAttributesEx(_path.c_str(), GetFileExInfoStandard, &fad) == 0) - handleLastErrorImpl(_path); - return Timestamp::fromFileTimeNP(fad.ftCreationTime.dwLowDateTime, fad.ftCreationTime.dwHighDateTime); -} - - -Timestamp FileImpl::getLastModifiedImpl() const -{ - poco_assert (!_path.empty()); - - WIN32_FILE_ATTRIBUTE_DATA fad; - if (GetFileAttributesEx(_path.c_str(), GetFileExInfoStandard, &fad) == 0) - handleLastErrorImpl(_path); - return Timestamp::fromFileTimeNP(fad.ftLastWriteTime.dwLowDateTime, fad.ftLastWriteTime.dwHighDateTime); -} - - -void FileImpl::setLastModifiedImpl(const Timestamp& ts) -{ - poco_assert (!_path.empty()); - - UInt32 low; - UInt32 high; - ts.toFileTimeNP(low, high); - FILETIME ft; - ft.dwLowDateTime = low; - ft.dwHighDateTime = high; - FileHandle fh(_path, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING); - if (SetFileTime(fh.get(), 0, &ft, &ft) == 0) - handleLastErrorImpl(_path); -} - - -FileImpl::FileSizeImpl FileImpl::getSizeImpl() const -{ - poco_assert (!_path.empty()); - - WIN32_FILE_ATTRIBUTE_DATA fad; - if (GetFileAttributesEx(_path.c_str(), GetFileExInfoStandard, &fad) == 0) - handleLastErrorImpl(_path); - LARGE_INTEGER li; - li.LowPart = fad.nFileSizeLow; - li.HighPart = fad.nFileSizeHigh; - return li.QuadPart; -} - - -void FileImpl::setSizeImpl(FileSizeImpl size) -{ - poco_assert (!_path.empty()); - - FileHandle fh(_path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING); - LARGE_INTEGER li; - li.QuadPart = size; - if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - handleLastErrorImpl(_path); - if (SetEndOfFile(fh.get()) == 0) - handleLastErrorImpl(_path); -} - - -void FileImpl::setWriteableImpl(bool flag) -{ - poco_assert (!_path.empty()); - - DWORD attr = GetFileAttributes(_path.c_str()); - if (attr == -1) - handleLastErrorImpl(_path); - if (flag) - attr &= ~FILE_ATTRIBUTE_READONLY; - else - attr |= FILE_ATTRIBUTE_READONLY; - if (SetFileAttributes(_path.c_str(), attr) == 0) - handleLastErrorImpl(_path); -} - - -void FileImpl::setExecutableImpl(bool flag) -{ - // not supported -} - - -void FileImpl::copyToImpl(const std::string& path, int options) const -{ - poco_assert (!_path.empty()); - - if (CopyFileA(_path.c_str(), path.c_str(), (options & OPT_FAIL_ON_OVERWRITE_IMPL) != 0) == 0) - handleLastErrorImpl(_path); -} - - -void FileImpl::renameToImpl(const std::string& path, int options) -{ - poco_assert (!_path.empty()); - - if (options & OPT_FAIL_ON_OVERWRITE_IMPL) { - if (MoveFileExA(_path.c_str(), path.c_str(), NULL) == 0) - handleLastErrorImpl(_path); - } else { - if (MoveFileExA(_path.c_str(), path.c_str(), MOVEFILE_REPLACE_EXISTING) == 0) - handleLastErrorImpl(_path); - } - -} - - -void FileImpl::linkToImpl(const std::string& path, int type) const -{ - poco_assert (!_path.empty()); - - if (type == 0) - { - if (CreateHardLinkA(path.c_str(), _path.c_str(), NULL) == 0) - handleLastErrorImpl(_path); - } - else - { -#if _WIN32_WINNT >= 0x0600 && defined(SYMBOLIC_LINK_FLAG_DIRECTORY) - DWORD flags = 0; - if (isDirectoryImpl()) flags |= SYMBOLIC_LINK_FLAG_DIRECTORY; -#ifdef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE - flags |= SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE; -#endif - if (CreateSymbolicLinkA(path.c_str(), _path.c_str(), flags) == 0) - handleLastErrorImpl(_path); -#else - throw Poco::NotImplementedException("Symbolic link support not available in used version of the Windows SDK") -#endif - - } -} - - -void FileImpl::removeImpl() -{ - poco_assert (!_path.empty()); - - if (isDirectoryImpl()) - { - if (RemoveDirectoryA(_path.c_str()) == 0) - handleLastErrorImpl(_path); - } - else - { - if (DeleteFileA(_path.c_str()) == 0) - handleLastErrorImpl(_path); - } -} - - -bool FileImpl::createFileImpl() -{ - poco_assert (!_path.empty()); - - HANDLE hFile = CreateFileA(_path.c_str(), GENERIC_WRITE, 0, 0, CREATE_NEW, 0, 0); - if (hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(hFile); - return true; - } - else if (GetLastError() == ERROR_FILE_EXISTS) - return false; - else - handleLastErrorImpl(_path); - return false; -} - - -bool FileImpl::createDirectoryImpl() -{ - poco_assert (!_path.empty()); - - if (existsImpl() && isDirectoryImpl()) - return false; - if (CreateDirectoryA(_path.c_str(), 0) == 0) - handleLastErrorImpl(_path); - return true; -} - - -FileImpl::FileSizeImpl FileImpl::totalSpaceImpl() const -{ - poco_assert(!_path.empty()); - - ULARGE_INTEGER space; - if (!GetDiskFreeSpaceExA(_path.c_str(), NULL, &space, NULL)) - handleLastErrorImpl(_path); - return space.QuadPart; -} - - -FileImpl::FileSizeImpl FileImpl::usableSpaceImpl() const -{ - poco_assert(!_path.empty()); - - ULARGE_INTEGER space; - if (!GetDiskFreeSpaceExA(upath.c_str(), &space, NULL, NULL)) - handleLastErrorImpl(_path); - return space.QuadPart; -} - - -FileImpl::FileSizeImpl FileImpl::freeSpaceImpl() const -{ - poco_assert(!_path.empty()); - - ULARGE_INTEGER space; - if (!GetDiskFreeSpaceExA(_path.c_str(), NULL, NULL, &space)) - handleLastErrorImpl(_path); - return space.QuadPart; -} - - -void FileImpl::handleLastErrorImpl(const std::string& path) -{ - DWORD err = GetLastError(); - switch (err) - { - case ERROR_FILE_NOT_FOUND: - throw FileNotFoundException(path, err); - case ERROR_PATH_NOT_FOUND: - case ERROR_BAD_NETPATH: - case ERROR_CANT_RESOLVE_FILENAME: - case ERROR_INVALID_DRIVE: - throw PathNotFoundException(path, err); - case ERROR_ACCESS_DENIED: - throw FileAccessDeniedException(path, err); - case ERROR_ALREADY_EXISTS: - case ERROR_FILE_EXISTS: - throw FileExistsException(path, err); - case ERROR_INVALID_NAME: - case ERROR_DIRECTORY: - case ERROR_FILENAME_EXCED_RANGE: - case ERROR_BAD_PATHNAME: - throw PathSyntaxException(path, err); - case ERROR_FILE_READ_ONLY: - throw FileReadOnlyException(path, err); - case ERROR_CANNOT_MAKE: - throw CreateFileException(path, err); - case ERROR_DIR_NOT_EMPTY: - throw DirectoryNotEmptyException(path, err); - case ERROR_WRITE_FAULT: - throw WriteFileException(path, err); - case ERROR_READ_FAULT: - throw ReadFileException(path, err); - case ERROR_SHARING_VIOLATION: - throw FileException("sharing violation", path, err); - case ERROR_LOCK_VIOLATION: - throw FileException("lock violation", path, err); - case ERROR_HANDLE_EOF: - throw ReadFileException("EOF reached", path, err); - case ERROR_HANDLE_DISK_FULL: - case ERROR_DISK_FULL: - throw WriteFileException("disk is full", path, err); - case ERROR_NEGATIVE_SEEK: - throw FileException("negative seek", path, err); - default: - throw FileException(path, err); - } -} - - -} // namespace Poco diff --git a/Foundation/src/LogFile_WIN32.cpp b/Foundation/src/LogFile_WIN32.cpp deleted file mode 100644 index 6a5c47a29..000000000 --- a/Foundation/src/LogFile_WIN32.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// -// LogFile_WIN32.cpp -// -// Library: Foundation -// Package: Logging -// Module: LogFile -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/LogFile_WIN32.h" -#include "Poco/File.h" -#include "Poco/Exception.h" - - -namespace Poco { - - -LogFileImpl::LogFileImpl(const std::string& path): _path(path), _hFile(INVALID_HANDLE_VALUE) -{ - File file(path); - if (file.exists()) - { - if (0 == sizeImpl()) - _creationDate = file.getLastModified(); - else - _creationDate = file.created(); - } -} - - -LogFileImpl::~LogFileImpl() -{ - CloseHandle(_hFile); -} - - -void LogFileImpl::writeImpl(const std::string& text, bool flush) -{ - if (INVALID_HANDLE_VALUE == _hFile) createFile(); - - DWORD bytesWritten; - BOOL res = WriteFile(_hFile, text.data(), (DWORD) text.size(), &bytesWritten, NULL); - if (!res) throw WriteFileException(_path); - res = WriteFile(_hFile, "\r\n", 2, &bytesWritten, NULL); - if (!res) throw WriteFileException(_path); - if (flush) - { - res = FlushFileBuffers(_hFile); - if (!res) throw WriteFileException(_path); - } -} - - -UInt64 LogFileImpl::sizeImpl() const -{ - if (INVALID_HANDLE_VALUE == _hFile) - { - File file(_path); - if (file.exists()) return file.getSize(); - else return 0; - } - - LARGE_INTEGER li; - li.HighPart = 0; - li.LowPart = SetFilePointer(_hFile, 0, &li.HighPart, FILE_CURRENT); - return li.QuadPart; -} - - -Timestamp LogFileImpl::creationDateImpl() const -{ - return _creationDate; -} - - -const std::string& LogFileImpl::pathImpl() const -{ - return _path; -} - - -void LogFileImpl::createFile() -{ - _hFile = CreateFileA(_path.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (_hFile == INVALID_HANDLE_VALUE) throw OpenFileException(_path); - SetFilePointer(_hFile, 0, 0, FILE_END); - // There seems to be a strange "optimization" in the Windows NTFS - // filesystem that causes it to reuse directory entries of deleted - // files. Example: - // 1. create a file named "test.dat" - // note the file's creation date - // 2. delete the file "test.dat" - // 3. wait a few seconds - // 4. create a file named "test.dat" - // the new file will have the same creation - // date as the old one. - // We work around this bug by taking the file's - // modification date as a reference when the - // file is empty. - if (sizeImpl() == 0) - _creationDate = File(_path).getLastModified(); - else - _creationDate = File(_path).created(); -} - -} // namespace Poco diff --git a/Foundation/src/NamedEvent_WIN32.cpp b/Foundation/src/NamedEvent_WIN32.cpp deleted file mode 100644 index 0aee72c5f..000000000 --- a/Foundation/src/NamedEvent_WIN32.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -// NamedEvent_WIN32.cpp -// -// Library: Foundation -// Package: Processes -// Module: NamedEvent -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/NamedEvent_WIN32.h" -#include "Poco/Error.h" -#include "Poco/Exception.h" -#include "Poco/Format.h" - - -namespace Poco { - - -NamedEventImpl::NamedEventImpl(const std::string& name): - _name(name) -{ - _event = CreateEventA(NULL, FALSE, FALSE, _name.c_str()); - if (!_event) - { - DWORD dwRetVal = GetLastError(); - throw SystemException(format("cannot create named event %s [Error %d: %s]", _name, (int)dwRetVal, Error::getMessage(dwRetVal))); - } -} - - -NamedEventImpl::~NamedEventImpl() -{ - CloseHandle(_event); -} - - -void NamedEventImpl::setImpl() -{ - if (!SetEvent(_event)) - throw SystemException("cannot signal named event", _name); -} - - -void NamedEventImpl::waitImpl() -{ - switch (WaitForSingleObject(_event, INFINITE)) - { - case WAIT_OBJECT_0: - return; - default: - throw SystemException("wait for named event failed", _name); - } -} - - -} // namespace Poco diff --git a/Foundation/src/NamedMutex_WIN32.cpp b/Foundation/src/NamedMutex_WIN32.cpp deleted file mode 100644 index 6d2a5c383..000000000 --- a/Foundation/src/NamedMutex_WIN32.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// NamedMutex_WIN32.cpp -// -// Library: Foundation -// Package: Processes -// Module: NamedMutex -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/NamedMutex_WIN32.h" -#include "Poco/Exception.h" - - -namespace Poco { - - -NamedMutexImpl::NamedMutexImpl(const std::string& name): - _name(name) -{ - _mutex = CreateMutexA(NULL, FALSE, _name.c_str()); - if (!_mutex) - throw SystemException("cannot create named mutex", _name); -} - - -NamedMutexImpl::~NamedMutexImpl() -{ - CloseHandle(_mutex); -} - - -void NamedMutexImpl::lockImpl() -{ - switch (WaitForSingleObject(_mutex, INFINITE)) - { - case WAIT_OBJECT_0: - return; - case WAIT_ABANDONED: - throw SystemException("cannot lock named mutex (abadoned)", _name); - default: - throw SystemException("cannot lock named mutex", _name); - } -} - - -bool NamedMutexImpl::tryLockImpl() -{ - switch (WaitForSingleObject(_mutex, 0)) - { - case WAIT_OBJECT_0: - return true; - case WAIT_TIMEOUT: - return false; - case WAIT_ABANDONED: - throw SystemException("cannot lock named mutex (abadoned)", _name); - default: - throw SystemException("cannot lock named mutex", _name); - } -} - - -void NamedMutexImpl::unlockImpl() -{ - ReleaseMutex(_mutex); -} - - -} // namespace Poco diff --git a/Foundation/src/Path_WIN32.cpp b/Foundation/src/Path_WIN32.cpp deleted file mode 100644 index 9d8b357a3..000000000 --- a/Foundation/src/Path_WIN32.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// -// Path_WIN32.cpp -// -// Library: Foundation -// Package: Filesystem -// Module: Path -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Path_WIN32.h" -#include "Poco/Environment_WIN32.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -std::string PathImpl::currentImpl() -{ - char buffer[MAX_PATH]; - DWORD n = GetCurrentDirectoryA(sizeof(buffer), buffer); - if (n > 0 && n < sizeof(buffer)) - { - std::string result(buffer, n); - if (result[n - 1] != '\\') - result.append("\\"); - return result; - } - else throw SystemException("Cannot get current directory"); -} - - -std::string PathImpl::systemImpl() -{ - char buffer[MAX_PATH]; - DWORD n = GetSystemDirectoryA(buffer, sizeof(buffer)); - if (n > 0 && n < sizeof(buffer)) - { - std::string result(buffer, n); - if (result[n - 1] != '\\') - result.append("\\"); - return result; - } - else throw SystemException("Cannot get system directory"); -} - - -std::string PathImpl::homeImpl() -{ - std::string result; - if (EnvironmentImpl::hasImpl("USERPROFILE")) - { - result = EnvironmentImpl::getImpl("USERPROFILE"); - } - else if (EnvironmentImpl::hasImpl("HOMEDRIVE") && EnvironmentImpl::hasImpl("HOMEPATH")) - { - result = EnvironmentImpl::getImpl("HOMEDRIVE"); - result.append(EnvironmentImpl::getImpl("HOMEPATH")); - } - else - { - result = systemImpl(); - } - - std::string::size_type n = result.size(); - if (n > 0 && result[n - 1] != '\\') - result.append("\\"); - return result; -} - - -std::string PathImpl::configHomeImpl() -{ - std::string result; - - // if APPDATA environment variable not exist, return home directory instead - try - { - result = EnvironmentImpl::getImpl("APPDATA"); - } - catch (NotFoundException&) - { - result = homeImpl(); - } - - std::string::size_type n = result.size(); - if (n > 0 && result[n - 1] != '\\') - result.append("\\"); - return result; -} - - -std::string PathImpl::dataHomeImpl() -{ - std::string result; - - // if LOCALAPPDATA environment variable not exist, return config home instead - try - { - result = EnvironmentImpl::getImpl("LOCALAPPDATA"); - } - catch (NotFoundException&) - { - result = configHomeImpl(); - } - - std::string::size_type n = result.size(); - if (n > 0 && result[n - 1] != '\\') - result.append("\\"); - return result; -} - - -std::string PathImpl::cacheHomeImpl() -{ - return tempImpl(); -} - - -std::string PathImpl::tempHomeImpl() -{ - return tempImpl(); -} - - -std::string PathImpl::tempImpl() -{ - char buffer[MAX_PATH]; - DWORD n = GetTempPathA(sizeof(buffer), buffer); - if (n > 0 && n < sizeof(buffer)) - { - n = GetLongPathNameA(buffer, buffer, static_cast(sizeof buffer)); - if (n <= 0) throw SystemException("Cannot get temporary directory long path name"); - std::string result(buffer, n); - if (result[n - 1] != '\\') - result.append("\\"); - return result; - } - else throw SystemException("Cannot get temporary directory"); -} - - -std::string PathImpl::configImpl() -{ - std::string result; - - // if PROGRAMDATA environment variable not exist, return system directory instead - try - { - result = EnvironmentImpl::getImpl("PROGRAMDATA"); - } - catch (NotFoundException&) - { - result = systemImpl(); - } - - std::string::size_type n = result.size(); - if (n > 0 && result[n - 1] != '\\') - result.append("\\"); - return result; -} - - -std::string PathImpl::nullImpl() -{ - return "NUL:"; -} - - -std::string PathImpl::expandImpl(const std::string& path) -{ - char buffer[MAX_PATH]; - DWORD n = ExpandEnvironmentStringsA(path.c_str(), buffer, sizeof(buffer)); - if (n > 0 && n < sizeof(buffer)) - return std::string(buffer, n - 1); - else - return path; -} - - -void PathImpl::listRootsImpl(std::vector& roots) -{ - roots.clear(); - char buffer[128]; - DWORD n = GetLogicalDriveStrings(sizeof(buffer) - 1, buffer); - char* it = buffer; - char* end = buffer + (n > sizeof(buffer) ? sizeof(buffer) : n); - while (it < end) - { - std::string dev; - while (it < end && *it) dev += *it++; - roots.push_back(dev); - ++it; - } -} - - -} // namespace Poco diff --git a/Foundation/src/Path_WIN32U.cpp b/Foundation/src/Path_WIN32U.cpp index ac757d6ea..db8e6cd25 100644 --- a/Foundation/src/Path_WIN32U.cpp +++ b/Foundation/src/Path_WIN32U.cpp @@ -13,7 +13,7 @@ #include "Poco/Path_WIN32U.h" -#include "Poco/Environment_WIN32.h" +#include "Poco/Environment_WIN32U.h" #include "Poco/UnicodeConverter.h" #include "Poco/Buffer.h" #include "Poco/Exception.h" diff --git a/Foundation/src/Process_WIN32.cpp b/Foundation/src/Process_WIN32.cpp deleted file mode 100644 index 469e6da5b..000000000 --- a/Foundation/src/Process_WIN32.cpp +++ /dev/null @@ -1,361 +0,0 @@ -// -// Process_WIN32.cpp -// -// Library: Foundation -// Package: Processes -// Module: Process -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Process_WIN32.h" -#include "Poco/Exception.h" -#include "Poco/NumberFormatter.h" -#include "Poco/NamedEvent.h" -#include "Poco/Pipe.h" - - -namespace Poco { - - -// -// ProcessHandleImpl -// -ProcessHandleImpl::ProcessHandleImpl(HANDLE hProcess, UInt32 pid) : - _hProcess(hProcess), - _pid(pid) -{ -} - - -ProcessHandleImpl::~ProcessHandleImpl() -{ - closeHandle(); -} - - -void ProcessHandleImpl::closeHandle() -{ - if (_hProcess) - { - CloseHandle(_hProcess); - _hProcess = NULL; - } -} - - -UInt32 ProcessHandleImpl::id() const -{ - return _pid; -} - - -HANDLE ProcessHandleImpl::process() const -{ - return _hProcess; -} - - -int ProcessHandleImpl::wait() const -{ - DWORD rc = WaitForSingleObject(_hProcess, INFINITE); - if (rc != WAIT_OBJECT_0) - throw SystemException("Wait failed for process", NumberFormatter::format(_pid)); - - DWORD exitCode; - if (GetExitCodeProcess(_hProcess, &exitCode) == 0) - throw SystemException("Cannot get exit code for process", NumberFormatter::format(_pid)); - - return exitCode; -} - - -int ProcessHandleImpl::tryWait() const -{ - DWORD exitCode; - if (GetExitCodeProcess(_hProcess, &exitCode) == 0) - throw SystemException("Cannot get exit code for process", NumberFormatter::format(_pid)); - if (exitCode == STILL_ACTIVE) - return -1; - else - return exitCode; -} - - -// -// ProcessImpl -// -ProcessImpl::PIDImpl ProcessImpl::idImpl() -{ - return GetCurrentProcessId(); -} - - -void ProcessImpl::timesImpl(long& userTime, long& kernelTime) -{ - FILETIME ftCreation; - FILETIME ftExit; - FILETIME ftKernel; - FILETIME ftUser; - - if (GetProcessTimes(GetCurrentProcess(), &ftCreation, &ftExit, &ftKernel, &ftUser) != 0) - { - ULARGE_INTEGER time; - time.LowPart = ftKernel.dwLowDateTime; - time.HighPart = ftKernel.dwHighDateTime; - kernelTime = long(time.QuadPart / 10000000L); - time.LowPart = ftUser.dwLowDateTime; - time.HighPart = ftUser.dwHighDateTime; - userTime = long(time.QuadPart / 10000000L); - } - else - { - userTime = kernelTime = -1; - } -} - - -static bool argNeedsEscaping(const std::string& arg) -{ - bool containsQuotableChar = std::string::npos != arg.find_first_of(" \t\n\v\""); - // Assume args that start and end with quotes are already quoted and do not require further quoting. - // There is probably code out there written before launch() escaped the arguments that does its own - // escaping of arguments. This ensures we do not interfere with those arguments. - bool isAlreadyQuoted = arg.size() > 1 && '\"' == arg[0] && '\"' == arg[arg.size() - 1]; - return containsQuotableChar && !isAlreadyQuoted; -} - - -// Based on code from https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ -static std::string escapeArg(const std::string& arg) -{ - if (argNeedsEscaping(arg)) - { - std::string quotedArg("\""); - for (std::string::const_iterator it = arg.begin(); ; ++it) - { - unsigned backslashCount = 0; - while (it != arg.end() && '\\' == *it) - { - ++it; - ++backslashCount; - } - - if (it == arg.end()) - { - quotedArg.append(2 * backslashCount, '\\'); - break; - } - else if ('"' == *it) - { - quotedArg.append(2 * backslashCount + 1, '\\'); - quotedArg.push_back('"'); - } - else - { - quotedArg.append(backslashCount, '\\'); - quotedArg.push_back(*it); - } - } - quotedArg.push_back('"'); - return quotedArg; - } - else - { - return arg; - } -} - - -ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, const std::string& initialDirectory, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe, const EnvImpl& env) -{ - std::string commandLine = command; - for (const auto& a: args) - { - commandLine.append(" "); - commandLine.append(escapeArg(a)); - } - - STARTUPINFOA startupInfo; - GetStartupInfoA(&startupInfo); // take defaults from current process - startupInfo.cb = sizeof(STARTUPINFOA); - startupInfo.lpReserved = NULL; - startupInfo.lpDesktop = NULL; - startupInfo.lpTitle = NULL; - startupInfo.dwFlags = STARTF_FORCEOFFFEEDBACK; - startupInfo.cbReserved2 = 0; - startupInfo.lpReserved2 = NULL; - - HANDLE hProc = GetCurrentProcess(); - bool mustInheritHandles = false; - if (inPipe) - { - DuplicateHandle(hProc, inPipe->readHandle(), hProc, &startupInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); - mustInheritHandles = true; - inPipe->close(Pipe::CLOSE_READ); - } - else if (GetStdHandle(STD_INPUT_HANDLE)) - { - DuplicateHandle(hProc, GetStdHandle(STD_INPUT_HANDLE), hProc, &startupInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); - mustInheritHandles = true; - } - else - { - startupInfo.hStdInput = 0; - } - // outPipe may be the same as errPipe, so we duplicate first and close later. - if (outPipe) - { - DuplicateHandle(hProc, outPipe->writeHandle(), hProc, &startupInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); - mustInheritHandles = true; - } - else if (GetStdHandle(STD_OUTPUT_HANDLE)) - { - DuplicateHandle(hProc, GetStdHandle(STD_OUTPUT_HANDLE), hProc, &startupInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); - mustInheritHandles = true; - } - else - { - startupInfo.hStdOutput = 0; - } - if (errPipe) - { - DuplicateHandle(hProc, errPipe->writeHandle(), hProc, &startupInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); - mustInheritHandles = true; - } - else if (GetStdHandle(STD_ERROR_HANDLE)) - { - DuplicateHandle(hProc, GetStdHandle(STD_ERROR_HANDLE), hProc, &startupInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); - mustInheritHandles = true; - } - else - { - startupInfo.hStdError = 0; - } - if (outPipe) outPipe->close(Pipe::CLOSE_WRITE); - if (errPipe) errPipe->close(Pipe::CLOSE_WRITE); - - if (mustInheritHandles) - { - startupInfo.dwFlags |= STARTF_USESTDHANDLES; - } - - const char* workingDirectory = initialDirectory.empty() ? 0 : initialDirectory.c_str(); - - const char* pEnv = 0; - std::vector envChars; - if (!env.empty()) - { - envChars = getEnvironmentVariablesBuffer(env); - pEnv = &envChars[0]; - } - - PROCESS_INFORMATION processInfo; - DWORD creationFlags = GetConsoleWindow() ? 0 : CREATE_NO_WINDOW; - BOOL rc = CreateProcessA( - NULL, - const_cast(commandLine.c_str()), - NULL, // processAttributes - NULL, // threadAttributes - mustInheritHandles, - creationFlags, - (LPVOID)pEnv, - workingDirectory, - &startupInfo, - &processInfo - ); - if (startupInfo.hStdInput) CloseHandle(startupInfo.hStdInput); - if (startupInfo.hStdOutput) CloseHandle(startupInfo.hStdOutput); - if (startupInfo.hStdError) CloseHandle(startupInfo.hStdError); - if (rc) - { - CloseHandle(processInfo.hThread); - return new ProcessHandleImpl(processInfo.hProcess, processInfo.dwProcessId); - } - else throw SystemException("Cannot launch process", command); -} - - -void ProcessImpl::killImpl(ProcessHandleImpl& handle) -{ - if (handle.process()) - { - if (TerminateProcess(handle.process(), 0) == 0) - { - handle.closeHandle(); - throw SystemException("cannot kill process"); - } - handle.closeHandle(); - } -} - -void ProcessImpl::killImpl(PIDImpl pid) -{ - HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid); - if (hProc) - { - if (TerminateProcess(hProc, 0) == 0) - { - CloseHandle(hProc); - throw SystemException("cannot kill process"); - } - CloseHandle(hProc); - } - else - { - switch (GetLastError()) - { - case ERROR_ACCESS_DENIED: - throw NoPermissionException("cannot kill process"); - case ERROR_NOT_FOUND: - throw NotFoundException("cannot kill process"); - case ERROR_INVALID_PARAMETER: - throw NotFoundException("cannot kill process"); - default: - throw SystemException("cannot kill process"); - } - } -} - - -bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle) -{ - bool result = true; - DWORD exitCode; - BOOL rc = GetExitCodeProcess(handle.process(), &exitCode); - if (!rc || exitCode != STILL_ACTIVE) result = false; - return result; -} - - -bool ProcessImpl::isRunningImpl(PIDImpl pid) -{ - HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); - bool result = true; - DWORD exitCode; - BOOL rc = GetExitCodeProcess(hProc, &exitCode); - if (!rc || exitCode != STILL_ACTIVE) result = false; - return result; -} - - -void ProcessImpl::requestTerminationImpl(PIDImpl pid) -{ - NamedEvent ev(terminationEventName(pid)); - ev.set(); -} - - -std::string ProcessImpl::terminationEventName(PIDImpl pid) -{ - std::string evName("POCOTRM"); - NumberFormatter::appendHex(evName, pid, 8); - return evName; -} - - -} // namespace Poco diff --git a/Foundation/src/Process_WIN32U.cpp b/Foundation/src/Process_WIN32U.cpp index 9cedd1116..2a553fd90 100644 --- a/Foundation/src/Process_WIN32U.cpp +++ b/Foundation/src/Process_WIN32U.cpp @@ -21,6 +21,7 @@ #include "Poco/File.h" #include "Poco/Path.h" #include "Poco/String.h" +#include "Poco/Ascii.h" namespace @@ -159,21 +160,30 @@ void ProcessImpl::timesImpl(long& userTime, long& kernelTime) } -static bool argNeedsEscaping(const std::string& arg) +bool ProcessImpl::mustEscapeArg(const std::string& arg) { - bool containsQuotableChar = std::string::npos != arg.find_first_of(" \t\n\v\""); - // Assume args that start and end with quotes are already quoted and do not require further quoting. - // There is probably code out there written before launch() escaped the arguments that does its own - // escaping of arguments. This ensures we do not interfere with those arguments. - bool isAlreadyQuoted = arg.size() > 1 && '\"' == arg[0] && '\"' == arg[arg.size() - 1]; - return containsQuotableChar && !isAlreadyQuoted; + bool result = false; + bool inQuotes = false; + for (char c: arg) + { + if (Poco::Ascii::isSpace(c) && !inQuotes) + { + result = true; + break; + } + else if (c == '"') + { + inQuotes = !inQuotes; + } + } + return result || inQuotes; } // Based on code from https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ -static std::string escapeArg(const std::string& arg) +std::string ProcessImpl::escapeArg(const std::string& arg) { - if (argNeedsEscaping(arg)) + if (mustEscapeArg(arg)) { std::string quotedArg("\""); for (std::string::const_iterator it = arg.begin(); ; ++it) @@ -204,10 +214,7 @@ static std::string escapeArg(const std::string& arg) quotedArg.push_back('"'); return quotedArg; } - else - { - return arg; - } + else return arg; } diff --git a/Foundation/src/SharedLibrary_WIN32.cpp b/Foundation/src/SharedLibrary_WIN32.cpp deleted file mode 100644 index 340a742e8..000000000 --- a/Foundation/src/SharedLibrary_WIN32.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -// SharedLibrary_WIN32.cpp -// -// Library: Foundation -// Package: SharedLibrary -// Module: SharedLibrary -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/SharedLibrary_WIN32.h" -#include "Poco/Path.h" -#include "Poco/UnWindows.h" - - -namespace Poco { - - -FastMutex SharedLibraryImpl::_mutex; - - -SharedLibraryImpl::SharedLibraryImpl() -{ - _handle = 0; -} - - -SharedLibraryImpl::~SharedLibraryImpl() -{ -} - - -void SharedLibraryImpl::loadImpl(const std::string& path, int /*flags*/) -{ - FastMutex::ScopedLock lock(_mutex); - - if (_handle) throw LibraryAlreadyLoadedException(_path); - DWORD flags(0); - Path p(path); - if (p.isAbsolute()) flags |= LOAD_WITH_ALTERED_SEARCH_PATH; - _handle = LoadLibraryExA(path.c_str(), 0, flags); - if (!_handle) throw LibraryLoadException(path); - _path = path; -} - - -void SharedLibraryImpl::unloadImpl() -{ - FastMutex::ScopedLock lock(_mutex); - - if (_handle) - { - FreeLibrary((HMODULE) _handle); - _handle = 0; - } - _path.clear(); -} - - -bool SharedLibraryImpl::isLoadedImpl() const -{ - return _handle != 0; -} - - -void* SharedLibraryImpl::findSymbolImpl(const std::string& name) -{ - FastMutex::ScopedLock lock(_mutex); - - if (_handle) - { - return (void*) GetProcAddress((HMODULE) _handle, name.c_str()); - } - else return 0; -} - - -const std::string& SharedLibraryImpl::getPathImpl() const -{ - return _path; -} - - -std::string SharedLibraryImpl::suffixImpl() -{ -#if defined(_DEBUG) && !defined(POCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX) - return "d.dll"; -#else - return ".dll"; -#endif -} - - -bool SharedLibraryImpl::setSearchPathImpl(const std::string& path) -{ -#if _WIN32_WINNT >= 0x0502 - return SetDllDirectoryA(path.c_str()) != 0; -#else - return false; -#endif -} - - -} // namespace Poco diff --git a/Foundation/testsuite/CMakeLists.txt b/Foundation/testsuite/CMakeLists.txt index f44a19b5b..66305bb30 100644 --- a/Foundation/testsuite/CMakeLists.txt +++ b/Foundation/testsuite/CMakeLists.txt @@ -2,63 +2,72 @@ set(TESTUNIT "Foundation-testrunner") # Sources file(GLOB SRCS_G "src/*.cpp") -file(GLOB SRCS_G_REMOVE - src/TestApp.cpp - src/TestApp_WINCE.cpp - src/TestLibrary.cpp - src/TestPlugin.cpp +file(GLOB SRCS_G_REMOVE + src/TestApp.cpp + src/TestApp_WINCE.cpp + src/TestLibrary.cpp + src/TestPlugin.cpp ) list(REMOVE_ITEM SRCS_G ${SRCS_G_REMOVE}) -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) # WinDriver depends on WinTestRunner which depends on MFC, and we don't want that -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Foundation-testrunner ${TEST_SRCS} ) +add_executable(Foundation-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Foundation WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;${CMAKE_BINARY_DIR}/bin/TestApp;${CMAKE_BINARY_DIR}/bin/TestLibrary.so" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Foundation-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Foundation + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;${CMAKE_BINARY_DIR}/bin/TestApp;${CMAKE_BINARY_DIR}/bin/TestLibrary.so" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Foundation-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Foundation WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND Foundation-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Foundation PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") # The SharedLibaryTest has to look for shared libraries in the working directory - set_property(TEST Foundation APPEND PROPERTY ENVIRONMENT "PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}") # The ProcessTest has to look for the TestApp in the working directory - set_property(TEST Foundation APPEND PROPERTY ENVIRONMENT "POCO_BASE=${CMAKE_SOURCE_DIR}") - # The test is run in the runtime directory. So the test data is copied there too - add_custom_command(TARGET Foundation-testrunner POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data ) + add_test( + NAME Foundation + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND Foundation-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Foundation PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") # The SharedLibaryTest has to look for shared libraries in the working directory + set_property(TEST Foundation APPEND PROPERTY ENVIRONMENT "PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}") # The ProcessTest has to look for the TestApp in the working directory + set_property(TEST Foundation APPEND PROPERTY ENVIRONMENT "POCO_BASE=${CMAKE_SOURCE_DIR}") + # The test is run in the runtime directory. So the test data is copied there too + add_custom_command( + TARGET Foundation-testrunner POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data + ) endif() -target_link_libraries(Foundation-testrunner PUBLIC Poco::Foundation CppUnit ) +target_link_libraries(Foundation-testrunner PUBLIC Poco::Foundation CppUnit) if(UNIX AND NOT ANDROID) target_link_libraries(Foundation-testrunner PUBLIC pthread) endif(UNIX AND NOT ANDROID) # TestApp if(WINCE) -add_executable( TestApp src/TestApp_WINCE.cpp ) +add_executable(TestApp src/TestApp_WINCE.cpp) set_target_properties(TestApp PROPERTIES LINK_FLAGS "/ENTRY:wmainCRTStartup") else() - add_executable( TestApp src/TestApp.cpp ) + add_executable(TestApp src/TestApp.cpp) endif() # The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests -set_target_properties( TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) -target_link_libraries( TestApp PUBLIC Poco::Foundation ) +set_target_properties(TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +target_link_libraries(TestApp PUBLIC Poco::Foundation) # TestLibrary -add_library(TestLibrary SHARED src/TestLibrary.cpp src/TestPlugin.cpp src/TestPlugin.h ) +add_library(TestLibrary SHARED src/TestLibrary.cpp src/TestPlugin.cpp src/TestPlugin.h) set_target_properties(TestLibrary PROPERTIES PREFIX "" DEBUG_POSTFIX "") # The test requires the library named TestLibrary. By default it is prefixed with lib. # The test is run in the runtime directory. So the TestLibrary is built there too because it is used by the tests -set_target_properties(TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) -target_link_libraries(TestLibrary PUBLIC Poco::Foundation ) +set_target_properties(TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +target_link_libraries(TestLibrary PUBLIC Poco::Foundation) add_dependencies(Foundation-testrunner TestApp TestLibrary) diff --git a/Foundation/testsuite/src/ProcessTest.cpp b/Foundation/testsuite/src/ProcessTest.cpp index 1681a774f..cac8718e8 100644 --- a/Foundation/testsuite/src/ProcessTest.cpp +++ b/Foundation/testsuite/src/ProcessTest.cpp @@ -16,6 +16,7 @@ #include "Poco/PipeStream.h" +using namespace std::string_literals; using Poco::Process; using Poco::ProcessHandle; using Poco::Pipe; @@ -33,6 +34,24 @@ ProcessTest::~ProcessTest() } +void ProcessTest::testEscapeArgs() +{ +#if defined(_WIN32) + assertTrue (Poco::ProcessImpl::mustEscapeArg("a b")); + assertFalse (Poco::ProcessImpl::mustEscapeArg("abc")); + assertFalse (Poco::ProcessImpl::mustEscapeArg("\"a b \"")); + assertFalse (Poco::ProcessImpl::mustEscapeArg("\"abc\"")); + assertTrue (Poco::ProcessImpl::mustEscapeArg("\"a b ")); + assertFalse (Poco::ProcessImpl::mustEscapeArg("/arg=\"a b c\"")); + + assertEquals ("abc"s, Poco::ProcessImpl::escapeArg("abc")); + assertEquals ("\"a b c\""s, Poco::ProcessImpl::escapeArg("a b c")); + assertEquals ("\"a b \\\" c\""s, Poco::ProcessImpl::escapeArg("a b \" c")); + assertEquals ("/arg=\"a b c\""s, Poco::ProcessImpl::escapeArg("/arg=\"a b c\"")); +#endif +} + + void ProcessTest::testLaunch() { std::string name("TestApp"); @@ -253,6 +272,7 @@ CppUnit::Test* ProcessTest::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ProcessTest"); + CppUnit_addTest(pSuite, ProcessTest, testEscapeArgs); CppUnit_addTest(pSuite, ProcessTest, testLaunch); CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectIn); CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectOut); diff --git a/Foundation/testsuite/src/ProcessTest.h b/Foundation/testsuite/src/ProcessTest.h index 130f4ad22..a99a77645 100644 --- a/Foundation/testsuite/src/ProcessTest.h +++ b/Foundation/testsuite/src/ProcessTest.h @@ -24,6 +24,7 @@ public: ProcessTest(const std::string& name); ~ProcessTest(); + void testEscapeArgs(); void testLaunch(); void testLaunchRedirectIn(); void testLaunchRedirectOut(); diff --git a/JSON/CMakeLists.txt b/JSON/CMakeLists.txt index 16545da83..bcbae095d 100644 --- a/JSON/CMakeLists.txt +++ b/JSON/CMakeLists.txt @@ -1,34 +1,34 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) POCO_SOURCES(SRCS pdjson src/pdjson.c) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(JSON ${SRCS} ) +add_library(JSON ${SRCS}) add_library(Poco::JSON ALIAS JSON) set_target_properties(JSON - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoJSON - DEFINE_SYMBOL JSON_EXPORTS - ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoJSON + DEFINE_SYMBOL JSON_EXPORTS +) target_link_libraries(JSON PUBLIC Poco::Foundation) target_include_directories(JSON - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) if(WIN32) target_compile_definitions(JSON PRIVATE _CRT_SECURE_NO_WARNINGS) @@ -41,8 +41,7 @@ endif() POCO_INSTALL(JSON) POCO_GENERATE_PACKAGE(JSON) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () - +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/JSON/samples/CMakeLists.txt b/JSON/samples/CMakeLists.txt index ae556cead..791284ebd 100644 --- a/JSON/samples/CMakeLists.txt +++ b/JSON/samples/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory( Benchmark ) +add_subdirectory(Benchmark) diff --git a/JSON/testsuite/CMakeLists.txt b/JSON/testsuite/CMakeLists.txt index 81988fb83..2a399f14f 100644 --- a/JSON/testsuite/CMakeLists.txt +++ b/JSON/testsuite/CMakeLists.txt @@ -1,29 +1,37 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(JSON-testrunner ${TEST_SRCS} ) +add_executable(JSON-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME JSON WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - 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/JSON-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME JSON + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + 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/JSON-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME JSON WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND JSON-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(JSON PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) - # The test is run in the build directory. So the test data is copied there too - add_custom_command(TARGET JSON-testrunner POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data ) + add_test( + NAME JSON + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND JSON-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(JSON PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + # The test is run in the build directory. So the test data is copied there too + add_custom_command( + TARGET JSON-testrunner POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data + ) endif() target_link_libraries(JSON-testrunner PUBLIC Poco::JSON CppUnit) - diff --git a/JWT/CMakeLists.txt b/JWT/CMakeLists.txt index 095e8c046..524de978e 100644 --- a/JWT/CMakeLists.txt +++ b/JWT/CMakeLists.txt @@ -1,37 +1,37 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(JWT ${SRCS} ) +add_library(JWT ${SRCS}) add_library(Poco::JWT ALIAS JWT) -set_target_properties( JWT - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} +set_target_properties(JWT + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoJWT - DEFINE_SYMBOL JWT_EXPORTS - ) + DEFINE_SYMBOL JWT_EXPORTS +) target_link_libraries(JWT PUBLIC Poco::JSON Poco::Crypto) target_include_directories(JWT - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(JWT) POCO_GENERATE_PACKAGE(JWT) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(testsuite) +endif() diff --git a/JWT/testsuite/CMakeLists.txt b/JWT/testsuite/CMakeLists.txt index 9d7c32625..32f1b3eec 100644 --- a/JWT/testsuite/CMakeLists.txt +++ b/JWT/testsuite/CMakeLists.txt @@ -1,28 +1,35 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(JWT-testrunner ${TEST_SRCS} ) +add_executable(JWT-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME JWT WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/JWT-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME JWT + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/JWT-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME JWT WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND JWT-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(JWT PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME JWT + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND JWT-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(JWT PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(JWT-testrunner PUBLIC Poco::JWT Poco::Crypto CppUnit) if(UNIX AND NOT ANDROID) - target_link_libraries(JWT-testrunner PUBLIC pthread) + target_link_libraries(JWT-testrunner PUBLIC pthread) endif(UNIX AND NOT ANDROID) diff --git a/MongoDB/CMakeLists.txt b/MongoDB/CMakeLists.txt index 0177f3dd4..7d9f9cd75 100644 --- a/MongoDB/CMakeLists.txt +++ b/MongoDB/CMakeLists.txt @@ -1,39 +1,39 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(MongoDB ${SRCS} ) +add_library(MongoDB ${SRCS}) add_library(Poco::MongoDB ALIAS MongoDB) set_target_properties(MongoDB - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoMongoDB - DEFINE_SYMBOL MongoDB_EXPORTS - ) + DEFINE_SYMBOL MongoDB_EXPORTS +) target_link_libraries(MongoDB PUBLIC Poco::Net) target_include_directories(MongoDB - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(MongoDB) POCO_GENERATE_PACKAGE(MongoDB) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/MongoDB/samples/CMakeLists.txt b/MongoDB/samples/CMakeLists.txt index 6d6b8c369..694dfab46 100644 --- a/MongoDB/samples/CMakeLists.txt +++ b/MongoDB/samples/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory( SQLToMongo ) +add_subdirectory(SQLToMongo) diff --git a/MongoDB/testsuite/CMakeLists.txt b/MongoDB/testsuite/CMakeLists.txt index 01fb30fd5..df40359d2 100644 --- a/MongoDB/testsuite/CMakeLists.txt +++ b/MongoDB/testsuite/CMakeLists.txt @@ -1,25 +1,31 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(MongoDB-testrunner ${TEST_SRCS} ) +add_executable(MongoDB-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME MongoDB WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/MongoDB-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME MongoDB + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/MongoDB-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME MongoDB WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND MongoDB-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) + add_test( + NAME MongoDB + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND MongoDB-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) set_tests_properties(MongoDB PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(MongoDB-testrunner PUBLIC Poco::MongoDB CppUnit) diff --git a/Net/CMakeLists.txt b/Net/CMakeLists.txt index d1c6f106f..758d5c58e 100644 --- a/Net/CMakeLists.txt +++ b/Net/CMakeLists.txt @@ -1,49 +1,49 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(Net ${SRCS} ) +add_library(Net ${SRCS}) add_library(Poco::Net ALIAS Net) -set_target_properties( Net - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} +set_target_properties(Net + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoNet - DEFINE_SYMBOL Net_EXPORTS - ) + DEFINE_SYMBOL Net_EXPORTS +) target_link_libraries(Net PUBLIC Poco::Foundation) # Windows and WindowsCE need additional libraries if(WIN32) - target_link_libraries(Net PUBLIC "iphlpapi.lib") - if(WINCE) - target_link_libraries(Net PUBLIC "ws2.lib") - else() - target_link_libraries(Net PUBLIC "ws2_32.lib") - endif() + target_link_libraries(Net PUBLIC "iphlpapi.lib") + if(WINCE) + target_link_libraries(Net PUBLIC "ws2.lib") + else() + target_link_libraries(Net PUBLIC "ws2_32.lib") + endif() endif(WIN32) target_include_directories(Net - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(Net) POCO_GENERATE_PACKAGE(Net) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/Net/testsuite/CMakeLists.txt b/Net/testsuite/CMakeLists.txt index fc3b21e4f..f302e795a 100644 --- a/Net/testsuite/CMakeLists.txt +++ b/Net/testsuite/CMakeLists.txt @@ -1,25 +1,32 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Net-testrunner ${TEST_SRCS} ) +add_executable(Net-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Net WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Net-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Net + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Net-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Net WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Net-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Net PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME Net + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND Net-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Net PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(Net-testrunner PUBLIC Poco::Net Poco::Util Poco::XML CppUnit) diff --git a/NetSSL_OpenSSL/CMakeLists.txt b/NetSSL_OpenSSL/CMakeLists.txt index ea75fc8bb..fe2d4a796 100644 --- a/NetSSL_OpenSSL/CMakeLists.txt +++ b/NetSSL_OpenSSL/CMakeLists.txt @@ -1,43 +1,43 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(NetSSL ${SRCS} ) +add_library(NetSSL ${SRCS}) add_library(Poco::NetSSL ALIAS NetSSL) -set_target_properties( NetSSL - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} +set_target_properties(NetSSL + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoNetSSL - DEFINE_SYMBOL NetSSL_EXPORTS - ) + DEFINE_SYMBOL NetSSL_EXPORTS +) target_link_libraries(NetSSL PUBLIC Poco::Crypto Poco::Util Poco::Net) target_include_directories(NetSSL - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) if(MSVC AND POCO_DISABLE_INTERNAL_OPENSSL AND OPENSSL_USE_STATIC_LIBS) - target_link_libraries(NetSSL PUBLIC ws2_32.lib Crypt32.lib) + target_link_libraries(NetSSL PUBLIC ws2_32.lib Crypt32.lib) endif() POCO_INSTALL(NetSSL) POCO_GENERATE_PACKAGE(NetSSL) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/NetSSL_OpenSSL/samples/CMakeLists.txt b/NetSSL_OpenSSL/samples/CMakeLists.txt index 66f895a6f..3c4ccbe22 100644 --- a/NetSSL_OpenSSL/samples/CMakeLists.txt +++ b/NetSSL_OpenSSL/samples/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory( HTTPSTimeServer ) -add_subdirectory( download ) -add_subdirectory( Mail ) -add_subdirectory( TwitterClient ) +add_subdirectory(HTTPSTimeServer) +add_subdirectory(download) +add_subdirectory(Mail) +add_subdirectory(TwitterClient) diff --git a/NetSSL_OpenSSL/testsuite/CMakeLists.txt b/NetSSL_OpenSSL/testsuite/CMakeLists.txt index c4e0c81a2..3858d935b 100644 --- a/NetSSL_OpenSSL/testsuite/CMakeLists.txt +++ b/NetSSL_OpenSSL/testsuite/CMakeLists.txt @@ -1,32 +1,39 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(NetSSL-testrunner ${TEST_SRCS} ) +add_executable(NetSSL-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME NetSSL WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/any.pem;${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem;${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/NetSSL-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME NetSSL + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/any.pem;${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem;${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/NetSSL-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME NetSSL WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND NetSSL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(NetSSL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) - # The test is run in the build directory. So the test data is copied there too - add_custom_command(TARGET NetSSL-testrunner POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NetSSL-testrunner.xml - ) + add_test( + NAME NetSSL + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND NetSSL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(NetSSL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + # The test is run in the build directory. So the test data is copied there too + add_custom_command( + TARGET NetSSL-testrunner POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NetSSL-testrunner.xml + ) endif() target_link_libraries(NetSSL-testrunner PUBLIC Poco::NetSSL Poco::Util Poco::XML CppUnit) - diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt index bd099ffc6..3e2b5fff9 100644 --- a/NetSSL_Win/CMakeLists.txt +++ b/NetSSL_Win/CMakeLists.txt @@ -1,40 +1,40 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() add_library(NetSSLWin ${SRCS}) add_library(Poco::NetSSLWin ALIAS NetSSLWin) set_target_properties(NetSSLWin - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoNetSSLWin - DEFINE_SYMBOL NetSSL_Win_EXPORTS - ) + DEFINE_SYMBOL NetSSL_Win_EXPORTS +) target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util Crypt32.lib) target_include_directories(NetSSLWin - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(NetSSLWin) POCO_GENERATE_PACKAGE(NetSSLWin) -if (ENABLE_TESTS) - #TODO: Looks like the samples use crypto somehow? - #add_subdirectory(samples) - #add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + #TODO: Looks like the samples use crypto somehow? + #add_subdirectory(samples) + #add_subdirectory(testsuite) +endif() diff --git a/NetSSL_Win/samples/CMakeLists.txt b/NetSSL_Win/samples/CMakeLists.txt index e6ad6f591..fe211b284 100644 --- a/NetSSL_Win/samples/CMakeLists.txt +++ b/NetSSL_Win/samples/CMakeLists.txt @@ -1,3 +1,3 @@ -add_subdirectory( HTTPSTimeServer ) -add_subdirectory( download ) -add_subdirectory( Mail ) +add_subdirectory(HTTPSTimeServer) +add_subdirectory(download) +add_subdirectory(Mail) diff --git a/NetSSL_Win/testsuite/CMakeLists.txt b/NetSSL_Win/testsuite/CMakeLists.txt index 3d528820a..ec45478a1 100644 --- a/NetSSL_Win/testsuite/CMakeLists.txt +++ b/NetSSL_Win/testsuite/CMakeLists.txt @@ -1,27 +1,32 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(NetSSLWin-testrunner ${TEST_SRCS} ) -add_test(NAME NetSSLWin WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND NetSSLWin-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) +add_executable(NetSSLWin-testrunner ${TEST_SRCS}) +add_test( + NAME NetSSLWin + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND NetSSLWin-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all +) set_tests_properties(NetSSLWin PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) target_link_libraries(NetSSLWin-testrunner PUBLIC Poco::NetSSL Poco::Util Poco::XML CppUnit) # The test is run in the build directory. So the test data is copied there too -add_custom_command(TARGET NetSSLWin-testrunner POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NetSSLWin.xml - ) +add_custom_command( + TARGET NetSSLWin-testrunner POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NetSSLWin.xml +) diff --git a/PDF/CMakeLists.txt b/PDF/CMakeLists.txt index 54cfbb2d5..1188726b8 100644 --- a/PDF/CMakeLists.txt +++ b/PDF/CMakeLists.txt @@ -1,153 +1,153 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found -if (POCO_UNBUNDLED) - find_package(ZLIB REQUIRED) +if(POCO_UNBUNDLED) + find_package(ZLIB REQUIRED) else() - # zlib - POCO_SOURCES( SRCS zlib - src/adler32.c - src/compress.c - src/crc32.c - src/deflate.c - src/gzio.c - src/infback.c - src/inffast.c - src/inflate.c - src/inftrees.c - src/trees.c - src/zutil.c - ) -endif (POCO_UNBUNDLED) + # zlib + POCO_SOURCES(SRCS zlib + src/adler32.c + src/compress.c + src/crc32.c + src/deflate.c + src/gzio.c + src/infback.c + src/inffast.c + src/inflate.c + src/inftrees.c + src/trees.c + src/zutil.c + ) +endif(POCO_UNBUNDLED) # TODO: Currently only bundled is supported, in future this should also be possible # with an unbundled version of hpdf # hpdf POCO_SOURCES(SRCS hpdf - src/hpdf_3dmeasure.c - src/hpdf_annotation.c - src/hpdf_array.c - src/hpdf_binary.c - src/hpdf_boolean.c - src/hpdf_catalog.c - src/hpdf_destination.c - src/hpdf_dict.c - src/hpdf_doc.c - src/hpdf_doc_png.c - src/hpdf_encoder.c - src/hpdf_encoder_cns.c - src/hpdf_encoder_cnt.c - src/hpdf_encoder_jp.c - src/hpdf_encoder_kr.c - src/hpdf_encoder_utf.c - src/hpdf_encrypt.c - src/hpdf_encryptdict.c - src/hpdf_error.c - src/hpdf_exdata.c - src/hpdf_ext_gstate.c - src/hpdf_font.c - src/hpdf_font_cid.c - src/hpdf_font_tt.c - src/hpdf_font_type1.c - src/hpdf_fontdef.c - src/hpdf_fontdef_base14.c - src/hpdf_fontdef_cid.c - src/hpdf_fontdef_cns.c - src/hpdf_fontdef_cnt.c - src/hpdf_fontdef_jp.c - src/hpdf_fontdef_kr.c - src/hpdf_fontdef_tt.c - src/hpdf_fontdef_type1.c - src/hpdf_gstate.c - src/hpdf_image.c - src/hpdf_image_ccitt.c - src/hpdf_image_png.c - src/hpdf_info.c - src/hpdf_list.c - src/hpdf_mmgr.c - src/hpdf_name.c - src/hpdf_namedict.c - src/hpdf_null.c - src/hpdf_number.c - src/hpdf_objects.c - src/hpdf_outline.c - src/hpdf_page_label.c - src/hpdf_page_operator.c - src/hpdf_pages.c - src/hpdf_pdfa.c - src/hpdf_real.c - src/hpdf_streams.c - src/hpdf_string.c - src/hpdf_u3d.c - src/hpdf_utils.c - src/hpdf_xref.c + src/hpdf_3dmeasure.c + src/hpdf_annotation.c + src/hpdf_array.c + src/hpdf_binary.c + src/hpdf_boolean.c + src/hpdf_catalog.c + src/hpdf_destination.c + src/hpdf_dict.c + src/hpdf_doc.c + src/hpdf_doc_png.c + src/hpdf_encoder.c + src/hpdf_encoder_cns.c + src/hpdf_encoder_cnt.c + src/hpdf_encoder_jp.c + src/hpdf_encoder_kr.c + src/hpdf_encoder_utf.c + src/hpdf_encrypt.c + src/hpdf_encryptdict.c + src/hpdf_error.c + src/hpdf_exdata.c + src/hpdf_ext_gstate.c + src/hpdf_font.c + src/hpdf_font_cid.c + src/hpdf_font_tt.c + src/hpdf_font_type1.c + src/hpdf_fontdef.c + src/hpdf_fontdef_base14.c + src/hpdf_fontdef_cid.c + src/hpdf_fontdef_cns.c + src/hpdf_fontdef_cnt.c + src/hpdf_fontdef_jp.c + src/hpdf_fontdef_kr.c + src/hpdf_fontdef_tt.c + src/hpdf_fontdef_type1.c + src/hpdf_gstate.c + src/hpdf_image.c + src/hpdf_image_ccitt.c + src/hpdf_image_png.c + src/hpdf_info.c + src/hpdf_list.c + src/hpdf_mmgr.c + src/hpdf_name.c + src/hpdf_namedict.c + src/hpdf_null.c + src/hpdf_number.c + src/hpdf_objects.c + src/hpdf_outline.c + src/hpdf_page_label.c + src/hpdf_page_operator.c + src/hpdf_pages.c + src/hpdf_pdfa.c + src/hpdf_real.c + src/hpdf_streams.c + src/hpdf_string.c + src/hpdf_u3d.c + src/hpdf_utils.c + src/hpdf_xref.c ) # TODO: Currently only bundled is supported, in future this should also be possible # with an unbundled version of libpng -POCO_SOURCES( SRCS libpng - src/png.c - src/pngerror.c - src/pnggccrd.c - src/pngget.c - src/pngmem.c - src/pngpread.c - src/pngread.c - src/pngrio.c - src/pngrtran.c - src/pngrutil.c - src/pngset.c - src/pngtest.c - src/pngtrans.c - src/pngvcrd.c - src/pngwio.c - src/pngwrite.c - src/pngwtran.c - src/pngwutil.c +POCO_SOURCES(SRCS libpng + src/png.c + src/pngerror.c + src/pnggccrd.c + src/pngget.c + src/pngmem.c + src/pngpread.c + src/pngread.c + src/pngrio.c + src/pngrtran.c + src/pngrutil.c + src/pngset.c + src/pngtest.c + src/pngtrans.c + src/pngvcrd.c + src/pngwio.c + src/pngwrite.c + src/pngwtran.c + src/pngwutil.c ) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() #TODO: Can we put this with the below includes? PRIVAT eg. -include_directories( "include/Poco/PDF" ) # zip src +include_directories("include/Poco/PDF") # zip src -add_library(PDF ${SRCS} ) +add_library(PDF ${SRCS}) add_library(Poco::PDF ALIAS PDF) set_target_properties(PDF - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoPDF - DEFINE_SYMBOL PDF_EXPORTS - ) + DEFINE_SYMBOL PDF_EXPORTS +) -if (POCO_UNBUNDLED) - target_link_libraries(PDF PUBLIC ZLIB::ZLIB) - target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED) -endif (POCO_UNBUNDLED) +if(POCO_UNBUNDLED) + target_link_libraries(PDF PUBLIC ZLIB::ZLIB) + target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED) +endif(POCO_UNBUNDLED) target_link_libraries(PDF PUBLIC Poco::XML Poco::Util) target_include_directories(PDF - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(PDF) POCO_GENERATE_PACKAGE(PDF) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/PDF/cmake/PocoPDFConfig.cmake b/PDF/cmake/PocoPDFConfig.cmake index a5c94ec3e..bc8aad35f 100644 --- a/PDF/cmake/PocoPDFConfig.cmake +++ b/PDF/cmake/PocoPDFConfig.cmake @@ -1,7 +1,7 @@ include(CMakeFindDependencyMacro) find_dependency(PocoFoundation) if(@POCO_UNBUNDLED@) - find_dependency(ZLIB REQUIRED) + find_dependency(ZLIB REQUIRED) endif() include("${CMAKE_CURRENT_LIST_DIR}/PocoPDFTargets.cmake") diff --git a/PDF/testsuite/CMakeLists.txt b/PDF/testsuite/CMakeLists.txt index bbc661b01..03935463c 100644 --- a/PDF/testsuite/CMakeLists.txt +++ b/PDF/testsuite/CMakeLists.txt @@ -1,21 +1,28 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -add_executable(PDF-testrunner ${TEST_SRCS} ) +add_executable(PDF-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME PDF WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/PDF-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME PDF + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/PDF-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME PDF WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND PDF-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) + add_test( + NAME PDF + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND PDF-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) set_tests_properties(PDF PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() -target_link_libraries(PDF-testrunner PUBLIC Poco::PDF CppUnit ) +target_link_libraries(PDF-testrunner PUBLIC Poco::PDF CppUnit) diff --git a/PageCompiler/CMakeLists.txt b/PageCompiler/CMakeLists.txt index c0b093150..c00110e80 100644 --- a/PageCompiler/CMakeLists.txt +++ b/PageCompiler/CMakeLists.txt @@ -2,20 +2,20 @@ set(POCO_EXENAME "PageCompiler") # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) -add_executable(PageCompiler ${SRCS} ) +add_executable(PageCompiler ${SRCS}) set_target_properties(PageCompiler - PROPERTIES - OUTPUT_NAME cpspc - ) + PROPERTIES + OUTPUT_NAME cpspc +) target_link_libraries(PageCompiler PUBLIC Poco::Net Poco::Util) install( TARGETS PageCompiler EXPORT PageCompilerTargets - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin - INCLUDES DESTINATION include - ) + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) diff --git a/PageCompiler/File2Page/CMakeLists.txt b/PageCompiler/File2Page/CMakeLists.txt index 76b5dde97..b8eadc31d 100644 --- a/PageCompiler/File2Page/CMakeLists.txt +++ b/PageCompiler/File2Page/CMakeLists.txt @@ -1,19 +1,19 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) -add_executable(File2Page ${SRCS} ) +add_executable(File2Page ${SRCS}) set_target_properties(File2Page - PROPERTIES - OUTPUT_NAME f2cpsp - ) + PROPERTIES + OUTPUT_NAME f2cpsp +) target_link_libraries(File2Page PUBLIC Poco::Util) install( TARGETS File2Page EXPORT File2PageTargets - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin - INCLUDES DESTINATION include - ) + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) diff --git a/PocoDoc/CMakeLists.txt b/PocoDoc/CMakeLists.txt index 56ea9ee19..92f37a936 100644 --- a/PocoDoc/CMakeLists.txt +++ b/PocoDoc/CMakeLists.txt @@ -1,15 +1,15 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) -add_executable(PocoDoc ${SRCS} ) +add_executable(PocoDoc ${SRCS}) target_link_libraries(PocoDoc PUBLIC Poco::Util Poco::XML Poco::CppParser) install( TARGETS PocoDoc EXPORT PocoDocTargets - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin - INCLUDES DESTINATION include - ) + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) diff --git a/Redis/CMakeLists.txt b/Redis/CMakeLists.txt index 27437edcb..a93bfd960 100644 --- a/Redis/CMakeLists.txt +++ b/Redis/CMakeLists.txt @@ -1,39 +1,39 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(Redis ${SRCS} ) +add_library(Redis ${SRCS}) add_library(Poco::Redis ALIAS Redis) set_target_properties(Redis - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoRedis - DEFINE_SYMBOL Redis_EXPORTS - ) + DEFINE_SYMBOL Redis_EXPORTS +) target_link_libraries(Redis PUBLIC Poco::Net) target_include_directories(Redis - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(Redis) POCO_GENERATE_PACKAGE(Redis) -if (ENABLE_TESTS) - add_subdirectory(testsuite) -# add_subdirectory(samples) -endif () +if(ENABLE_TESTS) + add_subdirectory(testsuite) +# add_subdirectory(samples) +endif() diff --git a/Redis/testsuite/CMakeLists.txt b/Redis/testsuite/CMakeLists.txt index 77005bd7c..422ffc493 100644 --- a/Redis/testsuite/CMakeLists.txt +++ b/Redis/testsuite/CMakeLists.txt @@ -1,30 +1,37 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Redis-testrunner ${TEST_SRCS} ) +add_executable(Redis-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Redis WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Redis-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Redis + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Redis-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Redis WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Redis-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Redis PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME Redis + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND Redis-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Redis PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() -target_link_libraries(Redis-testrunner PUBLIC ${CMAKE_THREAD_LIBS_INIT} Poco::Redis CppUnit ) +target_link_libraries(Redis-testrunner PUBLIC ${CMAKE_THREAD_LIBS_INIT} Poco::Redis CppUnit) if(OLD_REDIS_VERSION) - target_compile_definitions(Redis-testrunner PRIVATE OLD_REDIS_VERSION) + target_compile_definitions(Redis-testrunner PRIVATE OLD_REDIS_VERSION) endif(OLD_REDIS_VERSION) diff --git a/SevenZip/CMakeLists.txt b/SevenZip/CMakeLists.txt index 3ded645bb..ea07537b7 100644 --- a/SevenZip/CMakeLists.txt +++ b/SevenZip/CMakeLists.txt @@ -1,81 +1,81 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # TODO: Currently only bundled is supported, in future this should also be possible # with an unbundled version of 7z -POCO_SOURCES( SRCS 7z - src/7zAlloc.c - src/7zBuf2.c - src/7zBuf.c - src/7zCrc.c - src/7zCrcOpt.c - src/7zDec.c - src/7zFile.c - src/7zIn.c - src/7zStream.c - src/Alloc.c - src/Bcj2.c - src/Bra86.c - src/Bra.c -# src/BraIA64.c - src/CpuArch.c -# src/Delta.c -# src/LzFind.c -# src/LzFindMt.c - src/Lzma2Dec.c -# src/Lzma2Enc.c - src/Lzma86Dec.c -# src/Lzma86Enc.c - src/LzmaDec.c -# src/LzmaEnc.c -# src/LzmaLib.c -# src/MtCoder.c - src/Ppmd7.c - src/Ppmd7Dec.c -# src/Ppmd7Enc.c -# src/Sha256.c -# src/Threads.c -# src/Xz.c -# src/XzCrc64.c -# src/XzDec.c -# src/XzEnc.c -# src/XzIn.c +POCO_SOURCES(SRCS 7z + src/7zAlloc.c + src/7zBuf2.c + src/7zBuf.c + src/7zCrc.c + src/7zCrcOpt.c + src/7zDec.c + src/7zFile.c + src/7zIn.c + src/7zStream.c + src/Alloc.c + src/Bcj2.c + src/Bra86.c + src/Bra.c +# src/BraIA64.c + src/CpuArch.c +# src/Delta.c +# src/LzFind.c +# src/LzFindMt.c + src/Lzma2Dec.c +# src/Lzma2Enc.c + src/Lzma86Dec.c +# src/Lzma86Enc.c + src/LzmaDec.c +# src/LzmaEnc.c +# src/LzmaLib.c +# src/MtCoder.c + src/Ppmd7.c + src/Ppmd7Dec.c +# src/Ppmd7Enc.c +# src/Sha256.c +# src/Threads.c +# src/Xz.c +# src/XzCrc64.c +# src/XzDec.c +# src/XzEnc.c +# src/XzIn.c ) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(SevenZip ${SRCS} ) +add_library(SevenZip ${SRCS}) add_library(Poco::SevenZip ALIAS SevenZip) set_target_properties(SevenZip - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoSevenZip - DEFINE_SYMBOL SevenZip_EXPORTS - ) + DEFINE_SYMBOL SevenZip_EXPORTS +) target_link_libraries(SevenZip PUBLIC Poco::Util Poco::XML) target_include_directories(SevenZip - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(SevenZip) POCO_GENERATE_PACKAGE(SevenZip) -if (ENABLE_TESTS) - add_subdirectory(samples) - # TODO: Add tests - #add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + # TODO: Add tests + #add_subdirectory(testsuite) +endif() diff --git a/SevenZip/samples/CMakeLists.txt b/SevenZip/samples/CMakeLists.txt index 74a93e4b3..f64e7dddf 100644 --- a/SevenZip/samples/CMakeLists.txt +++ b/SevenZip/samples/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory( un7zip ) +add_subdirectory(un7zip) diff --git a/Util/CMakeLists.txt b/Util/CMakeLists.txt index 3a5210ad4..c667d79e5 100644 --- a/Util/CMakeLists.txt +++ b/Util/CMakeLists.txt @@ -1,55 +1,55 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -POCO_SOURCES_AUTO_PLAT( SRCS WIN32 - src/WinRegistryConfiguration.cpp - src/WinRegistryKey.cpp - src/WinService.cpp +POCO_SOURCES_AUTO_PLAT(SRCS WIN32 + src/WinRegistryConfiguration.cpp + src/WinRegistryKey.cpp + src/WinService.cpp ) -add_library(Util ${SRCS} ) +add_library(Util ${SRCS}) add_library(Poco::Util ALIAS Util) set_target_properties(Util - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoUtil - DEFINE_SYMBOL Util_EXPORTS - ) + DEFINE_SYMBOL Util_EXPORTS +) target_link_libraries(Util PUBLIC Poco::Foundation) -if (ENABLE_XML) +if(ENABLE_XML) target_link_libraries(Util PUBLIC Poco::XML) -else () - target_compile_definitions(Util PUBLIC POCO_UTIL_NO_XMLCONFIGURATION ) +else() + target_compile_definitions(Util PUBLIC POCO_UTIL_NO_XMLCONFIGURATION) endif() -if (ENABLE_JSON) +if(ENABLE_JSON) target_link_libraries(Util PUBLIC Poco::JSON) -else () - target_compile_definitions(Util PUBLIC POCO_UTIL_NO_JSONCONFIGURATION ) +else() + target_compile_definitions(Util PUBLIC POCO_UTIL_NO_JSONCONFIGURATION) endif() target_include_directories(Util - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) POCO_INSTALL(Util) POCO_GENERATE_PACKAGE(Util) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/Util/samples/CMakeLists.txt b/Util/samples/CMakeLists.txt index 62c21118e..667144099 100644 --- a/Util/samples/CMakeLists.txt +++ b/Util/samples/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory( SampleApp ) -add_subdirectory( SampleServer ) -add_subdirectory( Units ) -add_subdirectory( pkill ) +add_subdirectory(SampleApp) +add_subdirectory(SampleServer) +add_subdirectory(Units) +add_subdirectory(pkill) diff --git a/Util/src/HelpFormatter.cpp b/Util/src/HelpFormatter.cpp index 855b32446..c51099a63 100644 --- a/Util/src/HelpFormatter.cpp +++ b/Util/src/HelpFormatter.cpp @@ -142,7 +142,7 @@ int HelpFormatter::calcIndent() const } n += 2; if (n > indent) - indent = n; + indent = static_cast(n); } return indent; } diff --git a/Util/testsuite/CMakeLists.txt b/Util/testsuite/CMakeLists.txt index 1e52a2822..90332680a 100644 --- a/Util/testsuite/CMakeLists.txt +++ b/Util/testsuite/CMakeLists.txt @@ -1,32 +1,39 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 - src/WinConfigurationTest.cpp - src/WinRegistryTest.cpp - src/WinServiceTest.cpp - src/WindowsTestSuite.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WIN32 + src/WinConfigurationTest.cpp + src/WinRegistryTest.cpp + src/WinServiceTest.cpp + src/WindowsTestSuite.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Util-testrunner ${TEST_SRCS} ) +add_executable(Util-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Util WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Util-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Util + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Util-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Util WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Util-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Util PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME Util + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND Util-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Util PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(Util-testrunner PUBLIC Poco::Util Poco::JSON Poco::XML CppUnit) diff --git a/XML/CMakeLists.txt b/XML/CMakeLists.txt index 887c7ee9a..4fbf06f96 100644 --- a/XML/CMakeLists.txt +++ b/XML/CMakeLists.txt @@ -5,51 +5,51 @@ set(EXPAT_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/xmlparse.cpp") # Sources file(GLOB SRCS_G "src/*.cpp") list(REMOVE_ITEM SRCS_G ${EXPAT_CPP}) -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found -if (POCO_UNBUNDLED) - find_package(EXPAT REQUIRED) +if(POCO_UNBUNDLED) + find_package(EXPAT REQUIRED) else() - POCO_SOURCES( SRCS expat - src/xmlparse.cpp - src/xmlrole.c - src/xmltok.c - src/xmltok_impl.c - src/xmltok_ns.c - ) -endif (POCO_UNBUNDLED) + POCO_SOURCES(SRCS expat + src/xmlparse.cpp + src/xmlrole.c + src/xmltok.c + src/xmltok_impl.c + src/xmltok_ns.c + ) +endif(POCO_UNBUNDLED) -add_library(XML ${SRCS} ) +add_library(XML ${SRCS}) add_library(Poco::XML ALIAS XML) -set_target_properties( XML - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} +set_target_properties(XML + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} OUTPUT_NAME PocoXML - DEFINE_SYMBOL XML_EXPORTS - ) + DEFINE_SYMBOL XML_EXPORTS +) target_link_libraries(XML PUBLIC Poco::Foundation) target_include_directories(XML - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) -if (POCO_UNBUNDLED) +if(POCO_UNBUNDLED) target_link_libraries(XML PUBLIC EXPAT::EXPAT) target_compile_definitions(XML PUBLIC POCO_UNBUNDLED) else() @@ -65,8 +65,8 @@ endif() POCO_INSTALL(XML) POCO_GENERATE_PACKAGE(XML) -if (ENABLE_TESTS) +if(ENABLE_TESTS) add_subdirectory(samples) add_subdirectory(testsuite) -endif () +endif() diff --git a/XML/cmake/PocoXMLConfig.cmake b/XML/cmake/PocoXMLConfig.cmake index 237c9c9f1..ef58207f5 100644 --- a/XML/cmake/PocoXMLConfig.cmake +++ b/XML/cmake/PocoXMLConfig.cmake @@ -1,10 +1,10 @@ include(CMakeFindDependencyMacro) find_dependency(PocoFoundation) if(@POCO_UNBUNDLED@) - if(CMAKE_VERSION VERSION_LESS "3.10") - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V39") - endif() - find_dependency(EXPAT REQUIRED) + if(CMAKE_VERSION VERSION_LESS "3.10") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/V39") + endif() + find_dependency(EXPAT REQUIRED) endif() include("${CMAKE_CURRENT_LIST_DIR}/PocoXMLTargets.cmake") diff --git a/XML/testsuite/CMakeLists.txt b/XML/testsuite/CMakeLists.txt index 7ded39a35..aae415a07 100644 --- a/XML/testsuite/CMakeLists.txt +++ b/XML/testsuite/CMakeLists.txt @@ -1,25 +1,32 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(XML-testrunner ${TEST_SRCS} ) +add_executable(XML-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME XML WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/XML-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME XML + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/XML-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME XML WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND XML-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(XML PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + add_test( + NAME XML + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND XML-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(XML PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) endif() target_link_libraries(XML-testrunner PUBLIC Poco::XML CppUnit) diff --git a/Zip/CMakeLists.txt b/Zip/CMakeLists.txt index c3253e6e5..e89587ca5 100644 --- a/Zip/CMakeLists.txt +++ b/Zip/CMakeLists.txt @@ -1,39 +1,39 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "include/*.h" ) -POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "include/*.h") +POCO_HEADERS_AUTO(SRCS ${HDRS_G}) # Version Resource if(MSVC AND BUILD_SHARED_LIBS) - source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) + list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) endif() -add_library(Zip ${SRCS} ) +add_library(Zip ${SRCS}) add_library(Poco::Zip ALIAS Zip) -set_target_properties( Zip - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} - OUTPUT_NAME PocoZip - DEFINE_SYMBOL Zip_EXPORTS - ) +set_target_properties(Zip + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME PocoZip + DEFINE_SYMBOL Zip_EXPORTS +) target_link_libraries(Zip PUBLIC Poco::Util Poco::XML) target_include_directories(Zip - PUBLIC - $ - $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src - ) + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) POCO_INSTALL(Zip) POCO_GENERATE_PACKAGE(Zip) -if (ENABLE_TESTS) - add_subdirectory(samples) - add_subdirectory(testsuite) -endif () +if(ENABLE_TESTS) + add_subdirectory(samples) + add_subdirectory(testsuite) +endif() diff --git a/Zip/samples/CMakeLists.txt b/Zip/samples/CMakeLists.txt index 459b10b0c..25c93a206 100644 --- a/Zip/samples/CMakeLists.txt +++ b/Zip/samples/CMakeLists.txt @@ -1,2 +1,2 @@ -add_subdirectory( zip ) -add_subdirectory( unzip ) +add_subdirectory(zip) +add_subdirectory(unzip) diff --git a/Zip/testsuite/CMakeLists.txt b/Zip/testsuite/CMakeLists.txt index 981fb4ea6..aac6056cd 100644 --- a/Zip/testsuite/CMakeLists.txt +++ b/Zip/testsuite/CMakeLists.txt @@ -1,29 +1,36 @@ # Sources file(GLOB SRCS_G "src/*.cpp") -POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) +POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G}) # Headers -file(GLOB_RECURSE HDRS_G "src/*.h" ) -POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) +file(GLOB_RECURSE HDRS_G "src/*.h") +POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G}) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF - src/WinDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF + src/WinDriver.cpp ) -POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE - src/WinCEDriver.cpp +POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE + src/WinCEDriver.cpp ) -add_executable(Zip-testrunner ${TEST_SRCS} ) +add_executable(Zip-testrunner ${TEST_SRCS}) if(ANDROID) - add_test(NAME Zip WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - 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/Zip-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + add_test( + NAME Zip + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + 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/Zip-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake + ) else() - add_test(NAME Zip WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Zip-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all) - set_tests_properties(Zip PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) - # The test is run in the build directory. So the test data is copied there too - add_custom_command(TARGET Zip-testrunner POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data ) + add_test( + NAME Zip + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Zip-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all + ) + set_tests_properties(Zip PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) + # The test is run in the build directory. So the test data is copied there too + add_custom_command( + TARGET Zip-testrunner POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data + ) endif() target_link_libraries(Zip-testrunner PUBLIC Poco::Zip Poco::Net CppUnit) - diff --git a/cmake/DefinePlatformSpecifc.cmake b/cmake/DefinePlatformSpecifc.cmake index 4b3f915b3..ecba74fb5 100644 --- a/cmake/DefinePlatformSpecifc.cmake +++ b/cmake/DefinePlatformSpecifc.cmake @@ -31,7 +31,7 @@ if(MSVC) CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - ) + ) foreach(CompilerFlag ${CompilerFlags}) string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") endforeach() @@ -42,7 +42,7 @@ if(MSVC) endif(POCO_MT) if (ENABLE_MSVC_MP) - add_definitions(/MP) + add_definitions(/MP) endif() else(MSVC) @@ -54,15 +54,15 @@ endif(MSVC) # Add a d postfix to the debug libraries if(BUILD_SHARED_LIBS) - set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE) - set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set Release library postfix" FORCE) - set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "Set MinSizeRel library postfix" FORCE) - set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) + set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE) + set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set Release library postfix" FORCE) + set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "Set MinSizeRel library postfix" FORCE) + set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) else(BUILD_SHARED_LIBS) - set(CMAKE_DEBUG_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set Debug library postfix" FORCE) - set(CMAKE_RELEASE_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set Release library postfix" FORCE) - set(CMAKE_MINSIZEREL_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set MinSizeRel library postfix" FORCE) - set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) + set(CMAKE_DEBUG_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set Debug library postfix" FORCE) + set(CMAKE_RELEASE_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set Release library postfix" FORCE) + set(CMAKE_MINSIZEREL_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set MinSizeRel library postfix" FORCE) + set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) endif() diff --git a/cmake/ExecuteOnAndroid.cmake b/cmake/ExecuteOnAndroid.cmake index 7e3b384ff..407b95959 100644 --- a/cmake/ExecuteOnAndroid.cmake +++ b/cmake/ExecuteOnAndroid.cmake @@ -1,8 +1,8 @@ if(EXISTS "$ENV{ANDROID_HOME}") - set(ANDROID_SDK "$ENV{ANDROID_HOME}") + set(ANDROID_SDK "$ENV{ANDROID_HOME}") else() - set(ANDROID_SDK "${ANDROID_NDK}/..") + set(ANDROID_SDK "${ANDROID_NDK}/..") endif() message(STATUS "ANDROID_SDK path .... ${ANDROID_SDK}") get_filename_component(UNITTEST_FILENAME ${UNITTEST} NAME) @@ -15,7 +15,7 @@ endforeach() message(STATUS "Push ignored.sh to android ...") execute_process(COMMAND ${ANDROID_SDK}/platform-tools/adb push ${CMAKE_CURRENT_LIST_DIR}/../travis/ignored.sh /data/local/tmp/ OUTPUT_QUIET) message(STATUS "Push ${LIBRARY_DIR} to android ...") -execute_process(COMMAND ${ANDROID_SDK}/platform-tools/adb push ${LIBRARY_DIR} /data/local/tmp/ OUTPUT_QUIET) +execute_process(COMMAND ${ANDROID_SDK}/platform-tools/adb push ${LIBRARY_DIR} /data/local/tmp/ OUTPUT_QUIET) message(STATUS "Push ${UNITTEST} to android ...") execute_process(COMMAND ${ANDROID_SDK}/platform-tools/adb push ${UNITTEST} /data/local/tmp/ OUTPUT_QUIET) message(STATUS "Execute ${UNITTEST_FILENAME} ${TEST_PARAMETER} on android ...") @@ -25,7 +25,7 @@ execute_process( OUTPUT_VARIABLE _OUT ERROR_VARIABLE _ERR ) - + if(_RESULT) execute_process(COMMAND ls -l ${UNITTEST}) execute_process(COMMAND ${ANDROID_SDK}/platform-tools/adb shell "ls -R /data/local/tmp") diff --git a/cmake/FindAPR.cmake b/cmake/FindAPR.cmake index e2551135f..fdcabed3a 100644 --- a/cmake/FindAPR.cmake +++ b/cmake/FindAPR.cmake @@ -61,13 +61,13 @@ find_package_handle_standard_args(APR ) if(APR_FOUND) - set(APR_LIBRARIES ${APR_LIBRARY}) - set(APR_INCLUDE_DIRS ${APR_INCLUDE_DIR}) - set(APR_DEFINITIONS ${PC_APR_CFLAGS_OTHER}) + 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) + # 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) @@ -80,6 +80,6 @@ if(APR_FOUND AND NOT TARGET Apache::Apr) endif() mark_as_advanced( - APR_LIBRARY - APR_INCLUDE_DIR + APR_LIBRARY + APR_INCLUDE_DIR ) diff --git a/cmake/FindApache2.cmake b/cmake/FindApache2.cmake index 90d90ade4..adc31fb71 100644 --- a/cmake/FindApache2.cmake +++ b/cmake/FindApache2.cmake @@ -33,10 +33,10 @@ find_path(APACHE2_INCLUDE_DIR httpd.h 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 + FOUND_VAR APACHE2_FOUND + REQUIRED_VARS + APACHE2_INCLUDE_DIR + VERSION_VAR APACHE2_VERSION ) if(APACHE2_FOUND) @@ -45,5 +45,5 @@ if(APACHE2_FOUND) endif() mark_as_advanced( - APACHE2_INCLUDE_DIR + APACHE2_INCLUDE_DIR ) diff --git a/cmake/FindPostgreSQL.cmake b/cmake/FindPostgreSQL.cmake index 717ee2138..9163b90fa 100644 --- a/cmake/FindPostgreSQL.cmake +++ b/cmake/FindPostgreSQL.cmake @@ -76,33 +76,33 @@ 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} +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() + 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 + list(APPEND PostgreSQL_ROOT_DIRECTORIES "/usr") list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES "include/postgresql") @@ -112,19 +112,19 @@ 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}" + 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 @@ -144,67 +144,69 @@ find_path(PostgreSQL_INCLUDE_DIR # ) # The PostgreSQL library. -set (PostgreSQL_LIBRARY_TO_FIND pq) +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}) +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}" + 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) +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) +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}) + 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}" - ) + 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/PocoMacros.cmake b/cmake/PocoMacros.cmake index b99422dba..038779ec9 100644 --- a/cmake/PocoMacros.cmake +++ b/cmake/PocoMacros.cmake @@ -8,49 +8,49 @@ # Find the Microsoft mc.exe message compiler # -# CMAKE_MC_COMPILER - where to find mc.exe -if (WIN32) - # cmake has CMAKE_RC_COMPILER, but no message compiler - if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # this path is only present for 2008+, but we currently require PATH to - # be set up anyway - get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH) - 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) - get_filename_component(kit10_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH) - get_filename_component(kit10wow_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH) - file(GLOB kit10_list ${kit10_dir}/bin/10.* ${kit10wow_dir}/bin/10.*) - if (X64) - set(sdk_bindir "${sdk_dir}/bin/x64") - set(kit_bindir "${kit_dir}/bin/x64") - set(kit81_bindir "${kit81_dir}/bin/x64") - foreach (tmp_elem ${kit10_list}) - if (IS_DIRECTORY ${tmp_elem}) - list(APPEND kit10_bindir "${tmp_elem}/x64") - endif() - endforeach() - else (X64) - set(sdk_bindir "${sdk_dir}/bin") - set(kit_bindir "${kit_dir}/bin/x86") - set(kit81_bindir "${kit81_dir}/bin/x86") - foreach (tmp_elem ${kit10_list}) - if (IS_DIRECTORY ${tmp_elem}) - list(APPEND kit10_bindir "${tmp_elem}/x86") - endif() - endforeach() - endif (X64) - endif () - find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} - DOC "path to message compiler") - if (NOT CMAKE_MC_COMPILER) - message(FATAL_ERROR "message compiler not found: required to build") - endif (NOT CMAKE_MC_COMPILER) - message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") - mark_as_advanced(CMAKE_MC_COMPILER) +# CMAKE_MC_COMPILER - where to find mc.exe +if(WIN32) + # cmake has CMAKE_RC_COMPILER, but no message compiler + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # this path is only present for 2008+, but we currently require PATH to + # be set up anyway + get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH) + 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) + get_filename_component(kit10_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH) + get_filename_component(kit10wow_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH) + file(GLOB kit10_list ${kit10_dir}/bin/10.* ${kit10wow_dir}/bin/10.*) + if(X64) + set(sdk_bindir "${sdk_dir}/bin/x64") + set(kit_bindir "${kit_dir}/bin/x64") + set(kit81_bindir "${kit81_dir}/bin/x64") + foreach(tmp_elem ${kit10_list}) + if(IS_DIRECTORY ${tmp_elem}) + list(APPEND kit10_bindir "${tmp_elem}/x64") + endif() + endforeach() + else(X64) + set(sdk_bindir "${sdk_dir}/bin") + set(kit_bindir "${kit_dir}/bin/x86") + set(kit81_bindir "${kit81_dir}/bin/x86") + foreach(tmp_elem ${kit10_list}) + if(IS_DIRECTORY ${tmp_elem}) + list(APPEND kit10_bindir "${tmp_elem}/x86") + endif() + endforeach() + endif(X64) + endif() + find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} + DOC "path to message compiler") + if(NOT CMAKE_MC_COMPILER) + message(FATAL_ERROR "message compiler not found: required to build") + endif(NOT CMAKE_MC_COMPILER) + message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") + mark_as_advanced(CMAKE_MC_COMPILER) endif(WIN32) #=============================================================================== -# Macros for Source file management +# Macros for Source file management # # POCO_SOURCES_PLAT - Adds a list of files to the sources of a components # Usage: POCO_SOURCES_PLAT( out name platform sources) @@ -98,11 +98,10 @@ endif(WIN32) # Example: POCO_MESSAGES( HDRS Foundation include/Poco/Foundation.mc ) # - macro(POCO_SOURCES_PLAT out name platform) source_group("${name}\\Source Files" FILES ${ARGN}) list(APPEND ${out} ${ARGN}) - if(NOT (${platform})) + if(NOT(${platform})) set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) endif() endmacro() @@ -116,8 +115,7 @@ macro(POCO_SOURCES_AUTO out) endmacro() macro(POCO_SOURCES_AUTO_PLAT out platform) - foreach( f ${ARGN}) - + foreach(f ${ARGN}) get_filename_component(fname ${f} NAME) # Read the package name from the source file @@ -140,10 +138,8 @@ macro(POCO_SOURCES_AUTO_PLAT out platform) endforeach() endmacro() - macro(POCO_HEADERS_AUTO out) - foreach( f ${ARGN}) - + foreach(f ${ARGN}) get_filename_component(fname ${f} NAME) # Read the package name from the source file @@ -165,9 +161,8 @@ macro(POCO_HEADERS out name) list(APPEND ${out} ${ARGN}) endmacro() - macro(POCO_MESSAGES out name) - if (WIN32) + if(WIN32) foreach(msg ${ARGN}) get_filename_component(msg_name ${msg} NAME) get_filename_component(msg_path ${msg} ABSOLUTE) @@ -196,10 +191,9 @@ macro(POCO_MESSAGES out name) source_group("${name}\\Message Files" FILES ${ARGN}) list(APPEND ${out} ${ARGN}) - endif (WIN32) + endif(WIN32) endmacro() - #=============================================================================== # Macros for Package generation # @@ -211,32 +205,32 @@ endmacro() macro(POCO_GENERATE_PACKAGE target_name) include(CMakePackageConfigHelpers) write_basic_package_version_file( - "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion ) -if ("${CMAKE_VERSION}" VERSION_LESS "3.0.0") - if (NOT EXISTS "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake") - export(TARGETS "${target_name}" APPEND - FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" - NAMESPACE "${PROJECT_NAME}::" +if("${CMAKE_VERSION}" VERSION_LESS "3.0.0") + if(NOT EXISTS "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake") + export(TARGETS "${target_name}" APPEND + FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" + NAMESPACE "${PROJECT_NAME}::" + ) + endif() +else() + export(EXPORT "${target_name}Targets" + FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" + NAMESPACE "${PROJECT_NAME}::" ) - endif () -else () - export(EXPORT "${target_name}Targets" - FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" - NAMESPACE "${PROJECT_NAME}::" - ) -endif () +endif() configure_file("cmake/Poco${target_name}Config.cmake" - "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake" - @ONLY + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake" + @ONLY ) # 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 root CMakeLists.txt -if (WIN32) +if(WIN32) set(PocoConfigPackageLocation "cmake") else() set(PocoConfigPackageLocation "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}") @@ -247,7 +241,7 @@ install( FILE "${PROJECT_NAME}${target_name}Targets.cmake" NAMESPACE "${PROJECT_NAME}::" DESTINATION "${PocoConfigPackageLocation}" - ) +) install( FILES @@ -255,7 +249,7 @@ install( "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" DESTINATION "${PocoConfigPackageLocation}" COMPONENT Devel - ) +) endmacro() @@ -273,7 +267,7 @@ install( DESTINATION include COMPONENT Devel PATTERN ".svn" EXCLUDE - ) +) install( TARGETS "${target_name}" EXPORT "${target_name}Targets" @@ -281,11 +275,11 @@ install( ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin INCLUDES DESTINATION include - ) +) -if (MSVC) +if(MSVC) # install the targets pdb - POCO_INSTALL_PDB(${target_name}) + POCO_INSTALL_PDB(${target_name}) endif() endmacro() @@ -298,14 +292,13 @@ endmacro() # # This is an internal macro meant only to be used by POCO_INSTALL. macro(POCO_INSTALL_PDB target_name) - get_property(type TARGET ${target_name} PROPERTY TYPE) - if ("${type}" STREQUAL "SHARED_LIBRARY" OR "${type}" STREQUAL "EXECUTABLE") + if("${type}" STREQUAL "SHARED_LIBRARY" OR "${type}" STREQUAL "EXECUTABLE") install( FILES $ DESTINATION bin COMPONENT Devel OPTIONAL - ) - endif() + ) + endif() endmacro() diff --git a/doc/99100-ReleaseNotes.page b/doc/99100-ReleaseNotes.page index 6ea40cdaa..bde75f4bb 100644 --- a/doc/99100-ReleaseNotes.page +++ b/doc/99100-ReleaseNotes.page @@ -16,6 +16,11 @@ AAAIntroduction - GH #2909: Test failures on s390x architecture with 1.10.0 - GH #2911: Poco::UTF16Encoding and Poco::UTF32Encoding byte order conversion bug - GH #2912: Poco::SHA2Engine computes incorrect hash on big-endian systems + - GH #2923: cmake: Version 1.10.0 not parsed correctly from VERSION file + - GH #2908: [Windows] Process arguments quoting is broken. + - GH #2894: Poco 1.10.0 doesn't build with cmake & POCO_UNBUNDLED + - GH #2920: Close Service Handle after DeleteService Function call + - GH #2919: Fixed Crash in WinService::setFailureActions - MySQL: resetting the session when putting it back into a SessionPool is now optional (and disabled by default) due to a bug in MySQL messing up the character encoding when doing so. - Poco::AutoPtr and Poco::SharedPtr now support comparison with nullptr.