Cleanup cmake build system to use transitive dependency management from cmake (#2321)

* Some cleanup in the root CMakeLists.txt

* Cleanup cmake targets

* Add find openssl modul for older cmake version

* Set proper scope

* Change crypto default to off

* Fix openssl default to on

* Remove global setting of C99 standard

* Set from C11 to C99

* Fix for NetSSL win build

* Set C99 compile features

* Fix Windows build

* Fix windows build

* Cleanup poco unbundle definition

* Fix PDF build

* Remove unused set affinity

* Add _CRT_SECURE_NO_WARNINGS as target compile definitions

* Add _AFXDLL as target compile definitions

* Remove commented out line

* Refactor add_definitions to target_compile_definitons in Util

* Refactor add_definitions to target_compile_definitons in XML

* Remove THREADSAFE in data sql cmake build

* Refactor add_definitions to target_compile_definition in cmake mysql

* Refactor add_definitions to target_compile_definition in cmake odbc

* Refactor add_definitions to target_compile_definition in cmake sqlite

* Refactor add_definitions to target_compile_definitions in platform specific cmake

* Add _DEBUG as compile definition

* Add build dependencies between Foundation-testrunner and TestApp, TestLibrary in cmake build

* Use cmake property to build shared libs

* Cleanup POCO_NO_AUTOMATIC_LIBS. Set only for Windows in cmake build system

* cleanup LIB_MODE_DEFINITIONS in cmake buld system

* Add POCO_STATIC for CppUnit

* Cleanup target link libraries and add option dependencies.

* Add dependencies management in cmake

* Update cmake documentation

* Squashed commit of the following:

commit 38c233f93fc8e9ad6e24d686c905eb18c86e19a7

    Fix "invalid new-expression of abstract class type ApacheServerRequest" (#2231)

    - abstract method "bool secure() const" defined in HTTPServerRequest was implemented in ApacheServerRequest, one of its derived classes
     - a ap_log_error had one of its parameters changed for fixing a warning "passing NULL to non-pointer argument"
     - minor indentation problems corrected

commit 4cbdfbe828943871618172f9e042176f115d61d8

    Fix build dependencies

* Improve database cmake build dependencies

* Update doc

* Update doc

* Update cmake build commands

* Set public on target link libraries in cmake build system

* Fix PostgreSQL build

* Fix PostgreSQL build in cmake

* Fix PostgreSQL from SQL to Data

* Squashed commit of the following:

commit 1ba7d5dcbfb8d07860dd4efda33b31bedf6184c4

    Add missing cmake file

* Set path to PostgresSQL in AppVoyer

* Try to fix AppVeyor build

* show dir in appvoyer

* Disable PostgreSQL build on Appvoyer

* Refactor add_definitions to target_compile_definitions
This commit is contained in:
Joerg-Christian Boehme 2018-06-03 18:17:50 +02:00 committed by Aleksandar Fabijanic
parent 4542a15b86
commit 612f092235
128 changed files with 1693 additions and 1357 deletions

View File

@ -10,7 +10,7 @@ before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then tar -xzvf cmake-3.2.3-Linux-x86_64.tar.gz; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then tar -xzvf cmake-3.2.3-Linux-x86_64.tar.gz; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$PWD/cmake-3.2.3-Linux-x86_64/bin:$PATH; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$PWD/cmake-3.2.3-Linux-x86_64/bin:$PATH; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y unixodbc-dev libmysqlclient-dev g++-arm-linux-gnueabi g++-arm-linux-gnueabihf clang-3.5 libc++-dev sloccount cppcheck; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y unixodbc-dev libmysqlclient-dev g++-arm-linux-gnueabi g++-arm-linux-gnueabihf clang-3.5 libc++-dev ninja-build sloccount cppcheck; fi
services: services:
- mongodb - mongodb
@ -81,7 +81,7 @@ matrix:
# See also in /usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake # See also in /usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake
# Using the ninja build command. Is much faster then make build command. # Using the ninja build command. Is much faster then make build command.
- mkdir cmake-build && cd cmake-build && /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake -G'Android Gradle - Ninja' -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-19 -DCMAKE_MAKE_PROGRAM=/usr/local/android-sdk/cmake/3.6.4111459/bin/ninja -DANDROID_STL="c++_static" -DANDROID_CPP_FEATURES="exceptions rtti" -DENABLE_TESTS=ON -DENABLE_LONG_RUNNING_TESTS=OFF -DOLD_REDIS_VERSION=ON .. && /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake --build . --target all && travis_wait 30 /usr/local/android-sdk/cmake/3.6.4111459/bin/ctest -E Foundation --output-on-failure - /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake -H. -Bcmake-build -G'Android Gradle - Ninja' -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-19 -DCMAKE_MAKE_PROGRAM=/usr/local/android-sdk/cmake/3.6.4111459/bin/ninja -DANDROID_STL="c++_static" -DANDROID_CPP_FEATURES="exceptions rtti" -DENABLE_TESTS=ON -DENABLE_LONG_RUNNING_TESTS=OFF -DOLD_REDIS_VERSION=ON && /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake --build cmake-build --target all && cd cmake-build && travis_wait 30 /usr/local/android-sdk/cmake/3.6.4111459/bin/ctest -E Foundation --output-on-failure
- env: TEST_NAME="android API level 24" - env: TEST_NAME="android API level 24"
language: android language: android
@ -128,7 +128,7 @@ matrix:
# See also in /usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake # See also in /usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake
# Using the ninja build command. Is much faster then make build command. # Using the ninja build command. Is much faster then make build command.
- mkdir cmake-build && cd cmake-build && /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake -G'Android Gradle - Ninja' -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-24 -DCMAKE_MAKE_PROGRAM=/usr/local/android-sdk/cmake/3.6.4111459/bin/ninja -DANDROID_STL="c++_static" -DANDROID_CPP_FEATURES="exceptions rtti" -DENABLE_TESTS=ON -DENABLE_LONG_RUNNING_TESTS=OFF -DOLD_REDIS_VERSION=ON .. && /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake --build . --target all && travis_wait 30 /usr/local/android-sdk/cmake/3.6.4111459/bin/ctest -E Foundation --output-on-failure - /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake -H. -Bcmake-build -G'Android Gradle - Ninja' -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-24 -DCMAKE_MAKE_PROGRAM=/usr/local/android-sdk/cmake/3.6.4111459/bin/ninja -DANDROID_STL="c++_static" -DANDROID_CPP_FEATURES="exceptions rtti" -DENABLE_TESTS=ON -DENABLE_LONG_RUNNING_TESTS=OFF -DOLD_REDIS_VERSION=ON && /usr/local/android-sdk/cmake/3.6.4111459/bin/cmake --build cmake-build --target all && cd cmake-build && travis_wait 30 /usr/local/android-sdk/cmake/3.6.4111459/bin/ctest -E Foundation --output-on-failure
- env: TEST_NAME="gcc (make)" - env: TEST_NAME="gcc (make)"
compiler: gcc compiler: gcc
@ -150,7 +150,7 @@ matrix:
compiler: gcc compiler: gcc
script: script:
# disable tests, gcc-4.6 gets an internal compiler error # disable tests, gcc-4.6 gets an internal compiler error
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_PDF=OFF -DENABLE_TESTS=OFF .. && make all -j2 && cd .. - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=OFF && cmake --build cmake-build --target all
- env: TEST_NAME="gcc-4.8 (CMake)" - env: TEST_NAME="gcc-4.8 (CMake)"
compiler: gcc compiler: gcc
@ -160,24 +160,24 @@ matrix:
- sudo apt-get install -qq -y g++-4.8 - sudo apt-get install -qq -y g++-4.8
- export CC="gcc-4.8" - export CC="gcc-4.8"
- export CXX="g++-4.8" - export CXX="g++-4.8"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_PDF=OFF -DENABLE_TESTS=ON .. && make all -j2 && cd .. - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
- env: TEST_NAME="clang (CMake)" - env: TEST_NAME="clang (CMake)"
compiler: clang compiler: clang
script: script:
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_PDF=OFF -DENABLE_TESTS=ON .. && make all -j2 && cd .. - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
- env: TEST_NAME="arm-linux-gnueabi-g++ (CMake)" - env: TEST_NAME="arm-linux-gnueabi-g++ (CMake)"
script: script:
- export CC="arm-linux-gnueabi-gcc" - export CC="arm-linux-gnueabi-gcc"
- export CXX="arm-linux-gnueabi-g++" - export CXX="arm-linux-gnueabi-g++"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. && make all -j2 && cd .. - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
- env: TEST_NAME="arm-linux-gnueabihf-g++ (CMake)" - env: TEST_NAME="arm-linux-gnueabihf-g++ (CMake)"
script: script:
- export CC="arm-linux-gnueabihf-gcc" - export CC="arm-linux-gnueabihf-gcc"
- export CXX="arm-linux-gnueabihf-g++" - export CXX="arm-linux-gnueabihf-g++"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. && make all -j2 && cd .. - cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all
# TODO osx build # TODO osx build
# TODO run test suite # TODO run test suite

View File

@ -1,5 +1,3 @@
set(LIBNAME "mod_poco")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -8,19 +6,19 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" SHARED ${SRCS} ) add_library(mod_poco SHARED ${SRCS})
set_target_properties( "${LIBNAME}" set_target_properties(mod_poco
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
DEFINE_SYMBOL ApacheHandlers_EXPORTS) DEFINE_SYMBOL ApacheHandlers_EXPORTS)
target_link_libraries( "${LIBNAME}" ) target_include_directories(mod_poco
target_include_directories( "${LIBNAME}"
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)
endif () endif ()

View File

@ -48,14 +48,20 @@ public:
void sendErrorResponse(int status); void sendErrorResponse(int status);
/// Sends an error response with the given HTTP status code. /// Sends an error response with the given HTTP status code.
int sendFile(const std::string& path, unsigned int fileSize, const std::string& mediaType); int sendFile(const std::string& path, unsigned int fileSize, const std::string& mediaType);
/// Sends the file given by fileName as response. /// Sends the file given by fileName as response.
void copyHeaders(ApacheServerRequest& request); void copyHeaders(ApacheServerRequest& request);
/// Copies the request uri and header fields from the Apache request /// Copies the request uri and header fields from the Apache request
/// to the ApacheServerRequest. /// to the ApacheServerRequest.
bool secure();
/// Returns true if the request is using a secure
/// connection. Returns false if no secure connection
/// is used, or if it is not known whether a secure
/// connection is used.
private: private:
request_rec* _pRec; request_rec* _pRec;
}; };

View File

@ -58,6 +58,12 @@ public:
Poco::Net::HTTPServerResponse& response() const; Poco::Net::HTTPServerResponse& response() const;
/// Returns a reference to the associated response /// Returns a reference to the associated response
bool secure() const;
/// Returns true if the request is using a secure
/// connection. Returns false if no secure connection
/// is used, or if it is not known whether a secure
/// connection is used.
protected: protected:
void setResponse(ApacheServerResponse* pResponse); void setResponse(ApacheServerResponse* pResponse);

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "FormServer") add_library(FormServer src/FormServer.cpp)
target_link_libraries(FormServer PUBLIC Poco::Net)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_library( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "TimeServer-apache") add_library(TimeServer-apache src/TimeServer.cpp)
target_link_libraries(TimeServer-apache PUBLIC Poco::Net)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_library( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoFoundation )

View File

@ -131,6 +131,12 @@ int ApacheRequestRec::sendFile(const std::string& path, unsigned int fileSize, c
} }
bool ApacheRequestRec::secure()
{
return DEFAULT_HTTPS_PORT == ap_default_port(_pRec) && ap_http_scheme(_pRec) == "https";
}
void ApacheRequestRec::copyHeaders(ApacheServerRequest& request) void ApacheRequestRec::copyHeaders(ApacheServerRequest& request)
{ {
const apr_array_header_t* arr = apr_table_elts(_pRec->headers_in); const apr_array_header_t* arr = apr_table_elts(_pRec->headers_in);
@ -149,7 +155,13 @@ void ApacheRequestRec::copyHeaders(ApacheServerRequest& request)
void ApacheConnector::log(const char* file, int line, int level, int status, const char *text) void ApacheConnector::log(const char* file, int line, int level, int status, const char *text)
{ {
ap_log_error(file, line, level, 0, NULL, "%s", text); // ap_log_error() has undergone significant changes in Apache 2.4.
// Validate Apache version for using a proper ap_log_error() version.
#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER < 4
ap_log_error(file, line, level, 0, NULL, "%s", text);
#else
ap_log_error(file, line, level, 0, 0, 0, text);
#endif
} }
@ -172,24 +184,33 @@ extern "C" int ApacheConnector_handler(request_rec *r)
if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
return rv; return rv;
#ifndef POCO_ENABLE_CPP11 // The properties conn_rec->remote_ip and conn_rec->remote_addr have undergone significant changes in Apache 2.4.
std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest( // Validate Apache version for using conn_rec->remote_ip and conn_rec->remote_addr proper versions.
&rec, #if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER < 4
r->connection->local_ip, const char* clientIp = r->connection->remote_ip;
r->connection->local_addr->port, apr_port_t clientPort = r->connection->remote_addr->port;
r->connection->remote_ip,
r->connection->remote_addr->port));
std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#else #else
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest( const char* clientIp = r->connection->client_ip;
&rec, apr_port_t clientPort = r->connection->client_addr->port;
r->connection->local_ip, #endif
r->connection->local_addr->port, #ifndef POCO_ENABLE_CPP11
r->connection->remote_ip, std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
r->connection->remote_addr->port)); &rec,
r->connection->local_ip,
r->connection->local_addr->port,
clientIp,
clientPort));
std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get())); std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#else
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
r->connection->local_addr->port,
clientIp,
clientPort));
std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#endif // POCO_ENABLE_CPP11 #endif // POCO_ENABLE_CPP11
// add header information to request // add header information to request

View File

@ -35,7 +35,7 @@ ApacheServerRequest::~ApacheServerRequest()
delete _pStream; delete _pStream;
} }
const Poco::Net::HTTPServerParams& ApacheServerRequest::serverParams() const const Poco::Net::HTTPServerParams& ApacheServerRequest::serverParams() const
{ {
throw Poco::NotImplementedException("No HTTPServerParams available in Apache modules."); throw Poco::NotImplementedException("No HTTPServerParams available in Apache modules.");
@ -58,3 +58,9 @@ bool ApacheServerRequest::expectContinue() const
{ {
return false; return false;
} }
bool ApacheServerRequest::secure() const
{
return _pApacheRequest->secure();
}

View File

@ -1,30 +1,18 @@
# POCO_BUILD_TYPE
# POCO_STATIC
# POCO_UNBUNDLED
# POCO_NO_LOCALE
#
# ENABLE_{COMPONENT}
# ENABLE_TESTS
cmake_minimum_required(VERSION 3.2.0) cmake_minimum_required(VERSION 3.2.0)
project(Poco) project(Poco)
set(CMAKE_C_STANDARD 11)
file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION) file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION)
# Read the version information from the VERSION file # Read the version information from the VERSION file
file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION) file (STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION )
message(STATUS "Poco package 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_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}) string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION})
set(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set(RELEASE_NAME "Unstable-trunk") set(RELEASE_NAME "Unstable-trunk")
set(PROJECT_VERSION ${COMPLETE_VERSION})
set(CMAKE_C_STANDARD 99) message(STATUS "Poco package version: ${PROJECT_VERSION}")
# Put the libaries and binaries that get built into directories at the # Put the libaries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf # top of the build tree rather than in hard-to-find leaf
@ -36,14 +24,14 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Append our module directory to CMake # Append our module directory to CMake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# COMMENT REPLACED BY BIICODE
if(${CMAKE_VERSION} VERSION_LESS "3.4")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/V33)
endif()
################################################################################# #################################################################################
# Setup C/C++ compiler options # Setup C/C++ compiler options
################################################################################# #################################################################################
option(DISABLE_CPP11 "Disable C++11 if available" OFF) option(DISABLE_CPP11 "Disable C++11 if available" OFF)
option(DISABLE_CPP14 "Disable C++14 if available" OFF) option(DISABLE_CPP14 "Disable C++14 if available" OFF)
@ -70,42 +58,99 @@ else()
endif() endif()
endif() endif()
if(NOT MSVC_IDE) if(NOT CMAKE_BUILD_TYPE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release" FORCE)
endif()
message(STATUS "Setting Poco build type - ${CMAKE_BUILD_TYPE}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo") set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif() endif()
message(STATUS "Setting Poco build type - ${CMAKE_BUILD_TYPE}")
# Include some common macros to simpilfy the Poco CMake files # Include some common macros to simpilfy the Poco CMake files
include(PocoMacros) include(PocoMacros)
if(ENABLE_CRYPTO OR ENABLE_NETSSL)
find_package(OpenSSL REQUIRED)
else()
find_package(OpenSSL)
endif()
if(OPENSSL_FOUND)
option(ENABLE_NETSSL "Enable NetSSL" ON)
option(ENABLE_CRYPTO "Enable Crypto" ON)
else()
option(ENABLE_NETSSL "Enable NetSSL" OFF)
option(ENABLE_CRYPTO "Enable Crypto" OFF)
endif()
if(ENABLE_APACHECONNECTOR)
find_package(APR REQUIRED)
find_package(Apache2 REQUIRED)
else()
find_package(APR)
find_package(Apache2)
endif()
if(APRUTIL_FOUND AND APACHE_FOUND AND
EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR)
option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON)
else()
option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF)
endif()
if(ENABLE_DATA_MYSQL)
find_package(MySQL REQUIRED)
else()
find_package(MySQL)
endif()
if(MYSQL_FOUND)
option(ENABLE_DATA "Enable Data" ON)
option(ENABLE_DATA_MYSQL "Enable Data MySQL" ON)
else()
option(ENABLE_DATA "Enable Data" OFF)
option(ENABLE_DATA_MYSQL "Enable Data MySQL" OFF)
endif()
if(ENABLE_DATA_POSTGRESQL)
find_package(PostgreSQL REQUIRED)
else()
find_package(PostgreSQL QUIET)
endif()
if(POSTGRESQL_FOUND)
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)
endif()
if(ENABLE_DATA_ODBC)
find_package(ODBC REQUIRED)
else()
find_package(ODBC)
endif()
if(ODBC_FOUND)
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)
endif()
# Allow enabling and disabling components # Allow enabling and disabling components
option(ENABLE_ENCODINGS "Enable Encodings" ON) option(ENABLE_ENCODINGS "Enable Encodings" ON)
option(ENABLE_ENCODINGS_COMPILER "Enable Encodings Compiler" OFF) option(ENABLE_ENCODINGS_COMPILER "Enable Encodings Compiler" OFF)
option(ENABLE_XML "Enable XML" ON) option(ENABLE_XML "Enable XML" ON)
option(ENABLE_JSON "Enable JSON" ON) option(ENABLE_JSON "Enable JSON" ON)
option(ENABLE_MONGODB "Enable MongoDB" ON) option(ENABLE_MONGODB "Enable MongoDB" ON)
option(ENABLE_DATA_SQLITE "Enable Data SQlite" ON)
option(ENABLE_REDIS "Enable Redis" ON) option(ENABLE_REDIS "Enable Redis" ON)
option(ENABLE_PDF "Enable PDF" OFF) option(ENABLE_PDF "Enable PDF" OFF)
option(ENABLE_UTIL "Enable Util" ON) option(ENABLE_UTIL "Enable Util" ON)
option(ENABLE_NET "Enable Net" ON) option(ENABLE_NET "Enable Net" ON)
option(ENABLE_NETSSL "Enable NetSSL" ON)
option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF) option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF)
option(ENABLE_CRYPTO "Enable Crypto" ON)
option(ENABLE_DATA "Enable Data" ON)
option(ENABLE_DATA_SQLITE "Enable Data SQlite" ON)
option(ENABLE_DATA_MYSQL "Enable Data MySQL" ON)
option(ENABLE_DATA_POSTGRESQL "Enable Data PostgreSQL" ON)
option(ENABLE_DATA_ODBC "Enable Data ODBC" ON)
option(ENABLE_SEVENZIP "Enable SevenZip" OFF) option(ENABLE_SEVENZIP "Enable SevenZip" OFF)
option(ENABLE_ZIP "Enable Zip" ON) option(ENABLE_ZIP "Enable Zip" ON)
option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF)
option(ENABLE_CPPPARSER "Enable C++ parser" OFF) option(ENABLE_CPPPARSER "Enable C++ parser" OFF)
option(ENABLE_POCODOC "Enable Poco Documentation Generator" OFF) option(ENABLE_POCODOC "Enable Poco Documentation Generator" OFF)
option(ENABLE_PAGECOMPILER "Enable PageCompiler" ON) option(ENABLE_PAGECOMPILER "Enable PageCompiler" ON)
@ -118,6 +163,13 @@ option(ENABLE_TESTS
option(POCO_STATIC option(POCO_STATIC
"Set to OFF|ON (default is OFF) to control build of POCO as STATIC library" OFF) "Set to OFF|ON (default is OFF) to control build of POCO as STATIC library" OFF)
if(POCO_STATIC)
message(STATUS "Building static libraries")
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
else()
message(STATUS "Building dynamic libraries")
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
option(POCO_UNBUNDLED 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)
@ -130,16 +182,6 @@ if(MSVC)
"Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC" OFF) "Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC" OFF)
endif() endif()
# Uncomment from next two lines to force static or dynamic library, default is autodetection
if(POCO_STATIC)
set(LIB_MODE_DEFINITIONS -DPOCO_STATIC -DPOCO_NO_AUTOMATIC_LIBS)
set(LIB_MODE STATIC)
message(STATUS "Building static libraries")
else(POCO_STATIC)
set(LIB_MODE SHARED)
set(LIB_MODE_DEFINITIONS -DPOCO_NO_AUTOMATIC_LIBS)
message(STATUS "Building dynamic libraries")
endif(POCO_STATIC)
if(ENABLE_TESTS) if(ENABLE_TESTS)
option(ENABLE_LONG_RUNNING_TESTS "Enable long running test" ON) option(ENABLE_LONG_RUNNING_TESTS "Enable long running test" ON)
@ -151,7 +193,6 @@ else()
endif() endif()
if(POCO_UNBUNDLED) if(POCO_UNBUNDLED)
add_definitions(-DPOCO_UNBUNDLED)
message(STATUS "Using external sqlite, zlib, pcre, expat, ...") message(STATUS "Using external sqlite, zlib, pcre, expat, ...")
else() else()
message(STATUS "Using internal sqlite, zlib, pcre, expat, ...") message(STATUS "Using internal sqlite, zlib, pcre, expat, ...")
@ -164,41 +205,127 @@ set(Poco_COMPONENTS "")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_subdirectory(CppUnit) 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()
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)
endif()
if(ENABLE_PAGECOMPILER_FILE2PAGE)
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)
endif()
if(ENABLE_MONGODB OR ENABLE_REDIS)
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()
endif()
if(ENABLE_DATA AND ENABLE_TESTS)
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()
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)
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)
endif()
if(ENABLE_NET AND ENABLE_TESTS)
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)
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)
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)
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)
endif() endif()
add_subdirectory(Foundation) add_subdirectory(Foundation)
if(ENABLE_ENCODINGS) if(ENABLE_ENCODINGS)
add_subdirectory(Encodings) add_subdirectory(Encodings)
list(APPEND Poco_COMPONENTS "Encodings") list(APPEND Poco_COMPONENTS "Encodings")
endif() endif()
if(ENABLE_XML) if(ENABLE_XML)
add_subdirectory(XML) add_subdirectory(XML)
list(APPEND Poco_COMPONENTS "XML") list(APPEND Poco_COMPONENTS "XML")
endif() endif()
if(ENABLE_JSON) if(ENABLE_JSON)
add_subdirectory(JSON) add_subdirectory(JSON)
list(APPEND Poco_COMPONENTS "JSON") list(APPEND Poco_COMPONENTS "JSON")
endif() endif()
if(ENABLE_UTIL) if(ENABLE_UTIL)
add_subdirectory(Util) add_subdirectory(Util)
list(APPEND Poco_COMPONENTS "Util") list(APPEND Poco_COMPONENTS "Util")
endif() endif()
if(ENABLE_NET) if(ENABLE_NET)
add_subdirectory(Net) add_subdirectory(Net)
list(APPEND Poco_COMPONENTS "Net") list(APPEND Poco_COMPONENTS "Net")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/MongoDB AND ENABLE_MONGODB) if(EXISTS ${PROJECT_SOURCE_DIR}/MongoDB AND ENABLE_MONGODB)
add_subdirectory(MongoDB) add_subdirectory(MongoDB)
list(APPEND Poco_COMPONENTS "MongoDB") list(APPEND Poco_COMPONENTS "MongoDB")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/Redis AND ENABLE_REDIS) if(EXISTS ${PROJECT_SOURCE_DIR}/Redis AND ENABLE_REDIS)
add_subdirectory(Redis) add_subdirectory(Redis)
list(APPEND Poco_COMPONENTS "Redis") list(APPEND Poco_COMPONENTS "Redis")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/PDF AND ENABLE_PDF) if(EXISTS ${PROJECT_SOURCE_DIR}/PDF AND ENABLE_PDF)
add_subdirectory(PDF) add_subdirectory(PDF)
list(APPEND Poco_COMPONENTS "PDF") list(APPEND Poco_COMPONENTS "PDF")
endif() endif()
@ -210,65 +337,62 @@ if(WIN32 AND EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_Win AND ENABLE_NETSSL_WIN)
list(APPEND Poco_COMPONENTS "NetSSL_Win") list(APPEND Poco_COMPONENTS "NetSSL_Win")
endif(WIN32 AND EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_Win AND ENABLE_NETSSL_WIN) endif(WIN32 AND EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_Win AND ENABLE_NETSSL_WIN)
find_package(OpenSSL)
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
include_directories("${OPENSSL_INCLUDE_DIR}")
if(EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_OpenSSL AND ENABLE_NETSSL) if(EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_OpenSSL AND ENABLE_NETSSL)
add_subdirectory(NetSSL_OpenSSL) add_subdirectory(NetSSL_OpenSSL)
list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL") list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/Crypto AND ENABLE_CRYPTO) if(EXISTS ${PROJECT_SOURCE_DIR}/Crypto AND ENABLE_CRYPTO)
add_subdirectory(Crypto) add_subdirectory(Crypto)
list(APPEND Poco_COMPONENTS "Crypto") list(APPEND Poco_COMPONENTS "Crypto")
endif() endif()
endif(OPENSSL_FOUND) endif(OPENSSL_FOUND)
if(EXISTS ${PROJECT_SOURCE_DIR}/Data AND ENABLE_DATA) if(EXISTS ${PROJECT_SOURCE_DIR}/Data AND ENABLE_DATA)
add_subdirectory(Data) add_subdirectory(Data)
list(APPEND Poco_COMPONENTS "Data") list(APPEND Poco_COMPONENTS "Data")
endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/SevenZip AND ENABLE_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")
endif() endif()
find_package(APR) if(EXISTS ${PROJECT_SOURCE_DIR}/SevenZip AND ENABLE_SEVENZIP)
find_package(Apache2) add_subdirectory(SevenZip)
if(APRUTIL_FOUND AND APACHE_FOUND) list(APPEND Poco_COMPONENTS "SevenZip")
include_directories( "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/ApacheConnector AND ENABLE_APACHECONNECTOR)
if(EXISTS ${PROJECT_SOURCE_DIR}/Zip AND ENABLE_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)
include_directories( "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) # TODO(Bjoe) use target_include_directories or target_link_libraries
add_subdirectory(ApacheConnector) add_subdirectory(ApacheConnector)
list(APPEND Poco_COMPONENTS "ApacheConnector") list(APPEND Poco_COMPONENTS "ApacheConnector")
endif() endif()
endif(APRUTIL_FOUND AND APACHE_FOUND)
if(EXISTS ${PROJECT_SOURCE_DIR}/CppParser AND ENABLE_CPPPARSER) if(EXISTS ${PROJECT_SOURCE_DIR}/CppParser AND ENABLE_CPPPARSER)
add_subdirectory(CppParser) add_subdirectory(CppParser)
list(APPEND Poco_COMPONENTS "CppParser") list(APPEND Poco_COMPONENTS "CppParser")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/PocoDoc AND ENABLE_POCODOC) if(EXISTS ${PROJECT_SOURCE_DIR}/PocoDoc AND ENABLE_POCODOC)
add_subdirectory(PocoDoc) add_subdirectory(PocoDoc)
list(APPEND Poco_COMPONENTS "PocoDoc") list(APPEND Poco_COMPONENTS "PocoDoc")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/PageCompiler AND ENABLE_PAGECOMPILER) if(EXISTS ${PROJECT_SOURCE_DIR}/PageCompiler AND ENABLE_PAGECOMPILER)
add_subdirectory(PageCompiler) add_subdirectory(PageCompiler)
list(APPEND Poco_COMPONENTS "PageCompiler") list(APPEND Poco_COMPONENTS "PageCompiler")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/PageCompiler/File2Page AND ENABLE_PAGECOMPILER_FILE2PAGE) if(EXISTS ${PROJECT_SOURCE_DIR}/PageCompiler/File2Page AND ENABLE_PAGECOMPILER_FILE2PAGE)
add_subdirectory(PageCompiler/File2Page) add_subdirectory(PageCompiler/File2Page)
list(APPEND Poco_COMPONENTS "File2Page") list(APPEND Poco_COMPONENTS "File2Page")
endif() endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/Encodings/Compiler AND ENABLE_ENCODINGS_COMPILER) if(EXISTS ${PROJECT_SOURCE_DIR}/Encodings/Compiler AND ENABLE_ENCODINGS_COMPILER)
add_subdirectory(Encodings/Compiler) add_subdirectory(Encodings/Compiler)
list(APPEND Poco_COMPONENTS "EncodingsCompiler") list(APPEND Poco_COMPONENTS "EncodingsCompiler")
endif() endif()
@ -337,6 +461,5 @@ message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL:=${CMAKE_CXX_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO:=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO:=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
foreach(component ${Poco_COMPONENTS}) foreach(component ${Poco_COMPONENTS})
message(STATUS "Building: ${component}") message(STATUS "Building: ${component}")
endforeach() endforeach()

View File

@ -1,6 +1,3 @@
set(LIBNAME "CppParser")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,26 +6,25 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(CppParser ${SRCS})
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::CppParser ALIAS CppParser)
set_target_properties( "${LIBNAME}" set_target_properties(CppParser
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoCppParser
DEFINE_SYMBOL CppParser_EXPORTS DEFINE_SYMBOL CppParser_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation) target_link_libraries(CppParser PUBLIC Poco::Foundation)
target_include_directories( "${LIBNAME}" target_include_directories(CppParser
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(CppParser)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(CppParser)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(testsuite) add_subdirectory(testsuite)

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -12,11 +10,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF
src/WinDriver.cpp src/WinDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(CppParser-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME CppParser WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND CppParser-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoCppParser PocoFoundation CppUnit ) target_link_libraries(CppParser-testrunner PUBLIC Poco::CppParser CppUnit)

View File

@ -1,10 +1,4 @@
set(LIBNAME "CppUnit")
# Sources # Sources
add_definitions(-DPOCO_NO_AUTOMATIC_LIBS)
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif (WIN32)
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -12,16 +6,25 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(CppUnit ${SRCS})
set_target_properties( "${LIBNAME}" set_target_properties(CppUnit
PROPERTIES PROPERTIES
VERSION "1" SOVERSION "1" VERSION "1" SOVERSION "1"
DEFINE_SYMBOL CppUnit_EXPORTS) DEFINE_SYMBOL CppUnit_EXPORTS)
target_link_libraries( "${LIBNAME}" Foundation) target_link_libraries(CppUnit Poco::Foundation)
target_include_directories( "${LIBNAME}" target_include_directories(CppUnit
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) target_compile_definitions(CppUnit PUBLIC POCO_NO_AUTOMATIC_LIBS)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(CppUnit
PUBLIC
POCO_STATIC
)
endif()
if (WIN32)
target_compile_definitions(CppUnit PRIVATE _CRT_SECURE_NO_WARNINGS)
endif (WIN32)

View File

@ -1,5 +1,3 @@
set(LIBNAME "WinTestRunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( WIN_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( WIN_SRCS ${SRCS_G})
@ -11,26 +9,28 @@ POCO_HEADERS_AUTO( WIN_SRCS ${HDRS_G})
file(GLOB_RECURSE HDRS_G "src/*.h" ) file(GLOB_RECURSE HDRS_G "src/*.h" )
POCO_HEADERS_AUTO( WIN_SRCS ${HDRS_G}) POCO_HEADERS_AUTO( WIN_SRCS ${HDRS_G})
# TODO: Is this flag always required? add_library(WinTestRunner ${WIN_SRCS} )
add_definitions("-D_AFXDLL") set_target_properties(WinTestRunner
#TODO: Use instead of the flag above: find_package(MFC)
add_library( "${LIBNAME}" ${LIB_MODE} ${WIN_SRCS} )
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION "1" SOVERSION "1" VERSION "1" SOVERSION "1"
DEFINE_SYMBOL WinTestRunner_EXPORTS) DEFINE_SYMBOL WinTestRunner_EXPORTS)
target_link_libraries( "${LIBNAME}" CppUnit ) target_link_libraries(WinTestRunner PUBLIC CppUnit)
target_include_directories( "${LIBNAME}" target_include_directories(WinTestRunner
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) # TODO: Is this flag _AFXDLL always required?
target_compile_definitions(WinTestRunner
PRIVATE
_AFXDLL
)
#TODO: Use instead of the flag _AFXDLL above: find_package(MFC)
if(WIN32) if(WIN32)
target_link_libraries( ${LIBNAME} winmm ) target_link_libraries(WinTestRunner PUBLIC winmm)
endif(WIN32) endif(WIN32)

View File

@ -1,6 +1,3 @@
set(LIBNAME "Crypto")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,28 +6,25 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
#add_definitions(-D_USRDLL) add_library(Crypto ${SRCS} )
add_library(Poco::Crypto ALIAS Crypto)
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) set_target_properties(Crypto
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoCrypto
DEFINE_SYMBOL Crypto_EXPORTS DEFINE_SYMBOL Crypto_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation ${OPENSSL_LIBRARIES} ) target_link_libraries(Crypto PUBLIC Poco::Foundation OpenSSL::SSL OpenSSL::Crypto)
target_include_directories( "${LIBNAME}" target_include_directories(Crypto
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(Crypto)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(Crypto)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "genrsakey") add_executable(genrsakey src/genrsakey.cpp)
target_link_libraries(genrsakey PUBLIC Poco::Crypto Poco::Util Poco::XML)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoCrypto PocoUtil PocoXML PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,14 +14,14 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(Crypto-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME Crypto WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Crypto-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoCrypto PocoNetSSL PocoXML PocoUtil PocoFoundation CppUnit ) target_link_libraries(Crypto-testrunner PUBLIC Poco::NetSSL Poco::XML CppUnit)
if(UNIX AND NOT ANDROID) if(UNIX AND NOT ANDROID)
target_link_libraries( ${TESTUNIT} pthread) target_link_libraries(Crypto-testrunner PUBLIC pthread)
endif(UNIX AND NOT ANDROID) endif(UNIX AND NOT ANDROID)

View File

@ -1,6 +1,3 @@
set(LIBNAME "Data")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,81 +6,69 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
if (NOT POCO_STATIC)
add_definitions(-DTHREADSAFE)
endif (NOT POCO_STATIC)
if(MSVC AND NOT(MSVC_VERSION LESS 1400)) if(MSVC AND NOT(MSVC_VERSION LESS 1400))
set_source_files_properties(src/StatementImpl.cpp set_source_files_properties(src/StatementImpl.cpp
PROPERTIES COMPILE_FLAGS "/bigobj") PROPERTIES COMPILE_FLAGS "/bigobj")
endif() endif()
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Data ${SRCS} )
set_target_properties( "${LIBNAME}" add_library(Poco::Data ALIAS Data)
set_target_properties(Data
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoData
DEFINE_SYMBOL Data_EXPORTS DEFINE_SYMBOL Data_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation) target_link_libraries(Data PUBLIC Poco::Foundation)
target_include_directories( "${LIBNAME}" target_include_directories(Data
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(Data)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(Data)
if(ENABLE_DATA_SQLITE) if(ENABLE_DATA_SQLITE)
# SQlite3 is built in any case # SQlite3 is built in any case
message(STATUS "SQLite Support Enabled")
add_subdirectory( SQLite ) add_subdirectory( SQLite )
endif(ENABLE_DATA_SQLITE) else(ENABLE_DATA_SQLITE)
message(STATUS "SQLite Support Disabled")
endif()
if(ENABLE_DATA_MYSQL) if(MYSQL_FOUND AND ENABLE_DATA_MYSQL)
find_package(MySQL) include_directories("${MYSQL_INCLUDE_DIR}") # TODO(Bjoe) use target_include_directories or target_link_libraries
if(MYSQL_FOUND) message(STATUS "MySQL Support Enabled")
include_directories("${MYSQL_INCLUDE_DIR}") add_subdirectory( MySQL )
message(STATUS "MySQL Support Enabled") else()
add_subdirectory( MySQL ) message(STATUS "MySQL Support Disabled - no MySQL library")
endif()
if(POSTGRESQL_FOUND AND ENABLE_DATA_POSTGRESQL)
include_directories("${PostgreSQL_INCLUDE_DIR}") # TODO(Bjoe) Use target_link_libraries()
message(STATUS "PostgreSQL Support Enabled")
add_subdirectory( PostgreSQL )
else()
message(STATUS "PostgreSQL Support Disabled - no PostgreSQL library")
endif()
if(WIN32 AND NOT WINCE AND ENABLE_DATA_ODBC)
set(ODBC_LIBRARIES "odbc32" "odbccp32") # TODO(Bjoe) Verify if this is not set via find_package(ODBC)
message(STATUS "Windows native ODBC Support Enabled")
add_subdirectory( ODBC )
else()
if(ODBC_FOUND AND ENABLE_DATA_ODBC)
include_directories("${ODBC_INCLUDE_DIRECTORIES}") # TODO(Bjoe) use target_include_directories or target_link_libraries
message(STATUS "ODBC Support Enabled")
add_subdirectory( ODBC )
else() else()
message(STATUS "MySQL Support Disabled - no MySQL library") message(STATUS "ODBC Support Disabled - no ODBC runtime")
endif(MYSQL_FOUND) endif()
endif(ENABLE_DATA_MYSQL) endif()
if(ENABLE_DATA_POSTGRESQL)
find_package(PostgreSQL)
if(POSTGRESQL_FOUND)
include_directories("${PostgreSQL_INCLUDE_DIR}")
if(POCO_VERBOSE_MESSAGES)
message(STATUS "PostgreSQL Support Enabled")
endif()
add_subdirectory( PostgreSQL )
elseif(POCO_VERBOSE_MESSAGES)
message(STATUS "PostgreSQL Support Disabled - no PostgreSQL library")
endif(POSTGRESQL_FOUND)
endif(ENABLE_DATA_POSTGRESQL)
if(ENABLE_DATA_ODBC)
find_package(ODBC)
if(WIN32 AND NOT WINCE)
set(ODBC_LIBRARIES "odbc32" "odbccp32")
message(STATUS "Windows native ODBC Support Enabled")
add_subdirectory( ODBC )
else(WIN32 AND NOT WINCE)
if(ODBC_FOUND)
include_directories("${ODBC_INCLUDE_DIRECTORIES}")
message(STATUS "ODBC Support Enabled")
add_subdirectory( ODBC )
else()
message(STATUS "ODBC Support Disabled - no ODBC runtime")
endif()
endif(WIN32 AND NOT WINCE)
endif(ENABLE_DATA_ODBC)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,6 +1,3 @@
set(LIBNAME "DataMySQL")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( MYSQL_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( MYSQL_SRCS ${SRCS_G})
@ -9,28 +6,26 @@ POCO_SOURCES_AUTO( MYSQL_SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( MYSQL_SRCS ${HDRS_G}) POCO_HEADERS_AUTO( MYSQL_SRCS ${HDRS_G})
add_definitions(-DTHREADSAFE -DNO_TCL) add_library(DataMySQL ${MYSQL_SRCS} )
add_library(Poco::DataMySQL ALIAS DataMySQL)
add_library( "${LIBNAME}" ${LIB_MODE} ${MYSQL_SRCS} ) set_target_properties(DataMySQL
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoDataMySQL
DEFINE_SYMBOL MySQL_EXPORTS DEFINE_SYMBOL MySQL_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation Data ${MYSQL_LIB}) target_link_libraries(DataMySQL PUBLIC Poco::Data ${MYSQL_LIB})
target_include_directories( "${LIBNAME}" target_include_directories(DataMySQL
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) target_compile_definitions(DataMySQL PUBLIC THREADSAFE NO_TCL)
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(DataMySQL)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(DataMySQL)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(testsuite) add_subdirectory(testsuite)

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -12,11 +10,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF
src/WinDriver.cpp src/WinDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(DataMySQL-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME DataMySQL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataMySQL-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoDataMySQL PocoData PocoFoundation CppUnit ) target_link_libraries(DataMySQL-testrunner PUBLIC Poco::DataMySQL CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "DataODBC")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( ODBC_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( ODBC_SRCS ${SRCS_G})
@ -9,28 +6,26 @@ POCO_SOURCES_AUTO( ODBC_SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( ODBC_SRCS ${HDRS_G}) POCO_HEADERS_AUTO( ODBC_SRCS ${HDRS_G})
add_definitions( ${ODBC_CFLAGS} -DTHREADSAFE) add_library(DataODBC ${ODBC_SRCS})
add_library(Poco::DataODBC ALIAS DataODBC)
add_library( "${LIBNAME}" ${LIB_MODE} ${ODBC_SRCS} ) set_target_properties(DataODBC
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoDataODBC
DEFINE_SYMBOL ODBC_EXPORTS DEFINE_SYMBOL ODBC_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation Data ${ODBC_LIBRARIES}) target_link_libraries(DataODBC PUBLIC Poco::Data ${ODBC_LIBRARIES})
target_include_directories( "${LIBNAME}" target_include_directories(DataODBC
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) target_compile_definitions(DataODBC PUBLIC ${ODBC_CFLAGS} THREADSAFE)
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(DataODBC)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(DataODBC)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(testsuite) add_subdirectory(testsuite)

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -12,11 +10,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF
src/WinDriver.cpp src/WinDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(DataODBC-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME DataODBC WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataODBC-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoDataODBC PocoData PocoFoundation CppUnit ) target_link_libraries(DataODBC-testrunner PUBLIC Poco::DataODBC CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "SQLPostgreSQL")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( POSTGRESQL_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( POSTGRESQL_SRCS ${SRCS_G})
@ -9,25 +6,25 @@ POCO_SOURCES_AUTO( POSTGRESQL_SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( POSTGRESQL_SRCS ${HDRS_G}) POCO_HEADERS_AUTO( POSTGRESQL_SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${POSTGRESQL_SRCS} ) add_library(DataPostgreSQL ${POSTGRESQL_SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::DataPostgreSQL ALIAS DataPostgreSQL)
set_target_properties( "${LIBNAME}" set_target_properties(DataPostgreSQL
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoDataPostgreSQL
DEFINE_SYMBOL PostgreSQL_EXPORTS DEFINE_SYMBOL PostgreSQL_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation SQL ${PostgreSQL_LIBRARIES}) target_link_libraries(DataPostgreSQL PUBLIC Poco::Data ${PostgreSQL_LIBRARIES})
target_include_directories( "${LIBNAME}" target_include_directories(DataPostgreSQL
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(DataPostgreSQL)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(DataPostgreSQL)
if (POCO_ENABLE_TESTS) if (POCO_ENABLE_TESTS)
add_subdirectory(testsuite) add_subdirectory(testsuite)

View File

@ -0,0 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(PocoFoundation)
find_dependency(PocoData)
include("${CMAKE_CURRENT_LIST_DIR}/PocoDataPostgreSQLTargets.cmake")

View File

@ -1,4 +0,0 @@
include(CMakeFindDependencyMacro)
find_dependency(PocoFoundation)
find_dependency(PocoSQL)
include("${CMAKE_CURRENT_LIST_DIR}/PocoSQLPostgreSQLTargets.cmake")

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -12,6 +10,6 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF
src/WinDriver.cpp src/WinDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(DataPostgreSQL-testrunner ${TEST_SRCS} )
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME DataPostgreSQL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataPostgreSQL-testrunner -all)
target_link_libraries( ${TESTUNIT} PocoSQLPostgreSQL PocoSQL PocoFoundation CppUnit ${PostgreSQL_LIBRARIES}) target_link_libraries(DataPostgreSQL-testrunner PUBLIC Poco::DataPostgreSQL CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "DataSQLite")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SQLITE_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SQLITE_SRCS ${SRCS_G})
@ -10,9 +7,7 @@ file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G})
if (POCO_UNBUNDLED) if (POCO_UNBUNDLED)
find_package(SQLite3) find_package(SQLite3 REQUIRED)
set(DATASQLITELIBS ${SQLITE3_LIBRARIES})
include_directories("${SQLITE3_INCLUDE_DIRS}")
else() else()
# sqlite3 # sqlite3
POCO_SOURCES( SQLITE_SRCS sqlite3 POCO_SOURCES( SQLITE_SRCS sqlite3
@ -22,36 +17,45 @@ else()
POCO_HEADERS( SQLITE_SRCS sqlite3 POCO_HEADERS( SQLITE_SRCS sqlite3
src/sqlite3.h src/sqlite3.h
) )
set(DATASQLITELIBS "")
endif() endif()
if(WINCE) add_library(DataSQLite ${SQLITE_SRCS} )
add_definitions(-DSQLITE_MSVC_LOCALTIME_API)
endif(WINCE)
add_definitions(-DSQLITE_THREADSAFE=1 -DSQLITE_DISABLE_LFS -DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_DEPRECATED) add_library(Poco::DataSQLite ALIAS DataSQLite)
set_target_properties(DataSQLite
add_library( "${LIBNAME}" ${LIB_MODE} ${SQLITE_SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoDataSQLite
DEFINE_SYMBOL SQLite_EXPORTS DEFINE_SYMBOL SQLite_EXPORTS
) )
target_link_libraries(DataSQLite PUBLIC Poco::Data ${SQLITE3_LIBRARIES})
target_link_libraries( "${LIBNAME}" Foundation Data ${DATASQLITELIBS} ) target_include_directories(DataSQLite
target_include_directories( "${LIBNAME}"
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") if(POCO_UNBUNDLED)
POCO_GENERATE_PACKAGE("${LIBNAME}") target_include_directories(DataSQLite PUBLIC "${SQLITE3_INCLUDE_DIRS}")
target_compile_definitions(DataSQLite PUBLIC POCO_UNBUNDLED)
else()
if(WINCE)
target_compile_definitions(DataSQLite PRIVATE SQLITE_MSVC_LOCALTIME_API)
endif(WINCE)
target_compile_definitions(DataSQLite PRIVATE
SQLITE_THREADSAFE=1
SQLITE_DISABLE_LFS
SQLITE_OMIT_UTF16
SQLITE_OMIT_PROGRESS_CALLBACK
SQLITE_OMIT_COMPLETE
SQLITE_OMIT_TCL_VARIABLE
SQLITE_OMIT_DEPRECATED
)
endif()
POCO_INSTALL(DataSQLite)
POCO_GENERATE_PACKAGE(DataSQLite)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(testsuite) add_subdirectory(testsuite)

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,11 +14,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(DataSQLite-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME DataSQLite WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND DataSQLite-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoDataSQLite PocoData PocoFoundation CppUnit ) target_link_libraries(DataSQLite-testrunner PUBLIC Poco::DataSQLite CppUnit)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Binding") add_executable(Binding src/Binding.cpp)
target_link_libraries(Binding PUBLIC Poco::DataSQLite)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "RecordSet") add_executable(RecordSet src/RecordSet.cpp)
target_link_libraries(RecordSet PUBLIC Poco::DataSQLite)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "RowFormatter") add_executable(RowFormatter src/RowFormatter.cpp)
target_link_libraries(RowFormatter PUBLIC Poco::DataSQLite)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Tuple") add_executable(Tuple src/Tuple.cpp)
target_link_libraries(Tuple PUBLIC Poco::DataSQLite)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "TypeHandler") add_executable(TypeHandler src/TypeHandler.cpp)
target_link_libraries(TypeHandler PUBLIC Poco::DataSQLite)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "WebNotifier") add_executable(WebNotifier src/WebNotifier.cpp)
target_link_libraries(WebNotifier PUBLIC Poco::DataSQLite Poco::Net)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoNet PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -21,11 +19,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF
src/StatementImpl.cpp src/StatementImpl.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(Data-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME Data WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Data-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoData PocoUtil PocoXML PocoFoundation CppUnit) target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "Encodings")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES( SRCS Encodings ${SRCS_G}) POCO_SOURCES( SRCS Encodings ${SRCS_G})
@ -9,26 +6,25 @@ POCO_SOURCES( SRCS Encodings ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS( SRCS Encodings ${HDRS_G}) POCO_HEADERS( SRCS Encodings ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(Encodings ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::Encodings ALIAS Encodings)
set_target_properties( "${LIBNAME}" set_target_properties(Encodings
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoEncodings
DEFINE_SYMBOL Encodings_EXPORTS DEFINE_SYMBOL Encodings_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation) target_link_libraries(Encodings PUBLIC Poco::Foundation)
target_include_directories( "${LIBNAME}" target_include_directories(Encodings
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(Encodings)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(Encodings)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,21 +1,19 @@
set(POCO_EXENAME "EncodingsCompiler")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
add_executable( "${POCO_EXENAME}" ${SRCS} ) add_executable(EncodingsCompiler ${SRCS} )
set_target_properties( "${POCO_EXENAME}" set_target_properties(EncodingsCompiler
PROPERTIES PROPERTIES
OUTPUT_NAME tec OUTPUT_NAME tec
) )
target_link_libraries( "${POCO_EXENAME}" Net Util XML JSON Foundation) target_link_libraries(EncodingsCompiler PUBLIC Poco::Net Poco::Util)
install( install(
TARGETS "${POCO_EXENAME}" EXPORT "${POCO_EXENAME}Targets" TARGETS EncodingsCompiler EXPORT "EncodingsCompilerTargets"
LIBRARY DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
INCLUDES DESTINATION include INCLUDES DESTINATION include
) )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "TextConverter") add_executable(TextConverter src/TextConverter.cpp)
target_link_libraries(TextConverter PUBLIC Poco::Encodings)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoEncodings PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,16 +14,16 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(Encodings-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} add_test(NAME Encodings 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Encodings-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake)
else() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME Encodings WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Encodings-testrunner -all)
# The test is run in the build directory. So the test data is copied there too # The test is run in the build directory. So the test data is copied there too
add_custom_command(TARGET ${TESTUNIT} POST_BUILD add_custom_command(TARGET Encodings-testrunner POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data ) COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data )
endif() endif()
#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) #set_target_properties(Encodings-testrunner PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
target_link_libraries( ${TESTUNIT} PocoEncodings PocoFoundation CppUnit ) target_link_libraries(Encodings-testrunner PUBLIC Poco::Encodings CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "Foundation")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -33,8 +30,7 @@ POCO_MESSAGES( SRCS Logging src/pocomsg.mc)
# The configuration will fail if the packages are not found # The configuration will fail if the packages are not found
if (POCO_UNBUNDLED) if (POCO_UNBUNDLED)
find_package(PCRE REQUIRED) find_package(PCRE REQUIRED)
set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES}) find_package(ZLIB REQUIRED)
include_directories(${PCRE_INCLUDE_DIRS})
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
POCO_SOURCES( SRCS RegExp POCO_SOURCES( SRCS RegExp
@ -42,12 +38,6 @@ if (POCO_UNBUNDLED)
src/pcre_tables.c src/pcre_tables.c
) )
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
add_definitions(-DPOCO_UNBUNDLED)
else() else()
# pcre # pcre
POCO_SOURCES( SRCS pcre POCO_SOURCES( SRCS pcre
@ -94,84 +84,127 @@ else()
) )
endif (POCO_UNBUNDLED) endif (POCO_UNBUNDLED)
if(WIN32)
set(SYSLIBS ${SYSLIBS} iphlpapi)
endif(WIN32)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
set_target_properties( "${LIBNAME}" PROPERTIES LINK_FLAGS "-library=stlport4")
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
if(ANDROID) add_library(Foundation ${SRCS})
set(SYSLIBS ${SYSLIBS} log) add_library(Poco::Foundation ALIAS Foundation)
endif(ANDROID) set_target_properties(Foundation
# TODO: Why is this here?
add_definitions( -DPCRE_STATIC)
# For SetAffinity
if(UNIX AND NOT APPLE)
INCLUDE (CheckFunctionExists)
INCLUDE (CheckCXXSourceCompiles)
INCLUDE (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np "pthread.h" HAVE_PTHREAD_SETAFFINITY_NP)
#set(CMAKE_EXTRA_INCLUDE_FILES pthread.h)
#CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
if(NOT HAVE_PTHREAD_SETAFFINITY_NP)
message(STATUS "Platform has not PTHREAD_SETAFFINITY_NP")
else(HAVE_PTHREAD_SETAFFINITY_NP)
add_definitions(-DHAVE_PTHREAD_SETAFFINITY_NP)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main() {
cpu_set_t cpumask;
sched_setaffinity( 0, sizeof(cpumask), &cpumask );
return 0;
}" HAVE_THREE_PARAM_SCHED_SETAFFINITY)
if(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
message(STATUS "Platform has THREE PARAM at PTHREAD_SETAFFINITY_NP")
add_definitions(-DHAVE_THREE_PARAM_SCHED_SETAFFINITY)
else(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main() {
cpu_set_t cpumask;
sched_setaffinity( 0, &cpumask );
return 0;
}" HAVE_TWO_PARAM_SCHED_SETAFFINITY)
if(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
message(STATUS "Platform has TWO PARAM at PTHREAD_SETAFFINITY_NP")
add_definitions(-DHAVE_TWO_PARAM_SCHED_SETAFFINITY)
endif(HAVE_TWO_PARAM_SCHED_SETAFFINITY)
endif(HAVE_THREE_PARAM_SCHED_SETAFFINITY)
endif(NOT HAVE_PTHREAD_SETAFFINITY_NP)
endif(UNIX AND NOT APPLE)
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS})
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoFoundation
DEFINE_SYMBOL Foundation_EXPORTS DEFINE_SYMBOL Foundation_EXPORTS
) )
target_link_libraries( "${LIBNAME}" ${SYSLIBS}) target_link_libraries(Foundation PUBLIC ${PCRE_LIBRARIES} ${ZLIB_LIBRARIES})
target_include_directories( "${LIBNAME}" target_include_directories(Foundation
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") target_compile_definitions(Foundation
POCO_GENERATE_PACKAGE("${LIBNAME}") PUBLIC
$<$<CONFIG:Debug>:_DEBUG>
)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(Foundation
PUBLIC
POCO_STATIC
)
endif()
if(WIN32)
target_compile_definitions(Foundation PUBLIC POCO_NO_AUTOMATIC_LIBS POCO_OS_FAMILY_WINDOWS UNICODE _UNICODE __LCC__) #__LCC__ define used by MySQL.h
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)
else (CYGWIN)
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 (APPLE)
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)
else (QNX)
target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_EPOLL)
target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt)
endif (QNX)
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
)
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
)
endif()
# SunPro C++
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
target_compile_definitions(Foundation PUBLIC _BSD_SOURCE)
target_compile_options(Foundation PUBLIC -library=stlport4)
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
)
endif()
#Android
if (ANDROID)
target_compile_definitions(Foundation
PUBLIC
POCO_NO_FPENVIRONMENT
POCO_NO_WSTRING
POCO_NO_SHAREDMEMORY
)
target_link_libraries(Foundation PUBLIC log)
endif()
if(POCO_UNBUNDLED)
target_include_directories(Foundation PUBLIC "${PCRE_INCLUDE_DIRS}" "${ZLIB_INCLUDE_DIRS}")
target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED)
endif()
POCO_INSTALL(Foundation)
POCO_GENERATE_PACKAGE(Foundation)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory( samples ) add_subdirectory(samples)
add_subdirectory( testsuite ) add_subdirectory(testsuite)
endif () endif ()

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "ActiveMethod") add_executable(ActiveMethod src/ActiveMethod.cpp)
target_link_libraries(ActiveMethod PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Activity") add_executable(Activity src/Activity.cpp)
target_link_libraries(Activity PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "BinaryReaderWriter") add_executable(BinaryReaderWriter src/BinaryReaderWriter.cpp)
target_link_libraries(BinaryReaderWriter PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "DateTime") add_executable(DateTime src/DateTime.cpp)
target_link_libraries(DateTime PUBLIC Poco::Foundation)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "LineEndingConverter") add_executable(LineEndingConverter src/LineEndingConverter.cpp)
target_link_libraries(LineEndingConverter PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "LogRotation") add_executable(LogRotation src/LogRotation.cpp)
target_link_libraries(LogRotation PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Logger") add_executable(Logger src/Logger.cpp)
target_link_libraries(Logger PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "NotificationQueue") add_executable(NotificationQueue src/NotificationQueue.cpp)
target_link_libraries(NotificationQueue PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "StringTokenizer") add_executable(StringTokenizer src/StringTokenizer.cpp)
target_link_libraries(StringTokenizer PUBLIC Poco::JSON Poco::XML Poco::Foundation)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoJSON PocoXML PocoFoundation)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Timer") add_executable(Timer src/Timer.cpp)
target_link_libraries(Timer PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "URI") add_executable(URI src/URI.cpp)
target_link_libraries(URI PUBLIC Poco::JSON Poco::XML Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "base64decode") add_executable(base64decode src/base64decode.cpp)
target_link_libraries(base64decode PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "base64encode") add_executable(base64encode src/base64encode.cpp)
target_link_libraries(base64encode PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "deflate") add_executable(deflate src/deflate.cpp)
target_link_libraries(deflate PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "dir") add_executable(dir src/dir.cpp)
target_link_libraries(dir PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "grep") add_executable(grep src/grep.cpp)
target_link_libraries(grep PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "hmacmd5") add_executable(hmacmd5 src/hmacmd5.cpp)
target_link_libraries(hmacmd5 PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "inflate") add_executable(inflate src/inflate.cpp)
target_link_libraries(inflate PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "md5") add_executable(md5 src/md5.cpp)
target_link_libraries(md5 PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "uuidgen") add_executable(uuidgen src/uuidgen.cpp)
target_link_libraries(uuidgen PUBLIC Poco::Foundation )
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoFoundation )

View File

@ -1,4 +1,4 @@
set(TESTUNIT "${LIBNAME}-testrunner") set(TESTUNIT "Foundation-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
@ -24,44 +24,43 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(Foundation-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) add_test(NAME Foundation WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND Foundation-testrunner -all)
set_tests_properties(${LIBNAME} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=.") # The SharedLibaryTest has to look for shared libraries in the working directory set_tests_properties(Foundation PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=.") # The SharedLibaryTest has to look for shared libraries in the working directory
# The test is run in the runtime directory. So the test data is copied there too # The test is run in the runtime directory. So the test data is copied there too
add_custom_command(TARGET ${TESTUNIT} POST_BUILD add_custom_command(TARGET Foundation-testrunner POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data ) COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data )
endif() endif()
target_link_libraries( ${TESTUNIT} PocoFoundation CppUnit ) target_link_libraries(Foundation-testrunner PUBLIC Poco::Foundation CppUnit )
if(UNIX AND NOT ANDROID) if(UNIX AND NOT ANDROID)
target_link_libraries( ${TESTUNIT} pthread) target_link_libraries(Foundation-testrunner PUBLIC pthread)
endif(UNIX AND NOT ANDROID) endif(UNIX AND NOT ANDROID)
if(ENABLE_LONG_RUNNING_TESTS) if(ENABLE_LONG_RUNNING_TESTS)
target_compile_definitions( ${TESTUNIT} PRIVATE ENABLE_LONG_RUNNING_TESTS) target_compile_definitions(Foundation-testrunner PRIVATE ENABLE_LONG_RUNNING_TESTS)
endif(ENABLE_LONG_RUNNING_TESTS) endif(ENABLE_LONG_RUNNING_TESTS)
# TestApp # TestApp
if(WINCE) 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") set_target_properties(TestApp PROPERTIES LINK_FLAGS "/ENTRY:wmainCRTStartup")
else() else()
add_executable( TestApp src/TestApp.cpp ) add_executable( TestApp src/TestApp.cpp )
endif() endif()
# The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests # 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} ) set_target_properties( TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} )
target_link_libraries( TestApp PocoFoundation ) target_link_libraries( TestApp PUBLIC Poco::Foundation )
if(NOT POCO_STATIC)
# TestLibrary # 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. 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 # 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} ) set_target_properties(TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} )
target_link_libraries( TestLibrary PocoFoundation ) target_link_libraries(TestLibrary PUBLIC Poco::Foundation )
endif()
add_dependencies(Foundation-testrunner TestApp TestLibrary)

View File

@ -1,11 +1,4 @@
set(LIBNAME "JSON")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif (WIN32)
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -13,30 +6,34 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
POCO_SOURCES(SRCS pdjson src/pdjson.c) POCO_SOURCES(SRCS pdjson src/pdjson.c)
if(WIN32)
SET_SOURCE_FILES_PROPERTIES(src/pdjson.c PROPERTIES LANGUAGE CXX)
endif()
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(JSON ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::JSON ALIAS JSON)
set_target_properties( "${LIBNAME}" set_target_properties(JSON
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoJSON
DEFINE_SYMBOL JSON_EXPORTS DEFINE_SYMBOL JSON_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation) target_link_libraries(JSON PUBLIC Poco::Foundation)
target_include_directories( "${LIBNAME}" target_include_directories(JSON
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") if(WIN32)
POCO_GENERATE_PACKAGE("${LIBNAME}") target_compile_definitions(JSON PRIVATE _CRT_SECURE_NO_WARNINGS)
set_source_files_properties(src/pdjson.c PROPERTIES LANGUAGE CXX)
set_property(TARGET JSON PROPERTY C_STANDARD 99)
else()
target_compile_features(JSON PUBLIC c_variadic_macros)
endif()
POCO_INSTALL(JSON)
POCO_GENERATE_PACKAGE(JSON)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Benchmark") add_executable(Benchmark src/Benchmark.cpp)
target_link_libraries(Benchmark PUBLIC Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoJSON PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,15 +14,15 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(JSON-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME JSON WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND JSON-testrunner -all)
# The test is run in the build directory. So the test data is copied there too # The test is run in the build directory. So the test data is copied there too
add_custom_command(TARGET ${TESTUNIT} POST_BUILD add_custom_command(TARGET JSON-testrunner POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data ) COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data )
endif() endif()
target_link_libraries( ${TESTUNIT} PocoJSON PocoFoundation CppUnit ) target_link_libraries(JSON-testrunner PUBLIC Poco::JSON CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "MongoDB")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,26 +6,25 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(MongoDB ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::MongoDB ALIAS MongoDB)
set_target_properties( "${LIBNAME}" set_target_properties(MongoDB
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoMongoDB
DEFINE_SYMBOL MongoDB_EXPORTS DEFINE_SYMBOL MongoDB_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Net Foundation) target_link_libraries(MongoDB PUBLIC Poco::Net)
target_include_directories( "${LIBNAME}" target_include_directories(MongoDB
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(MongoDB)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(MongoDB)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "SQLToMongo") add_executable(SQLToMongo src/SQLToMongo.cpp)
target_link_libraries(SQLToMongo PUBLIC Poco::MongoDB)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoMongoDB PocoNet PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,13 +14,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
set(TESTUNIT "${LIBNAME}-testrunner") add_executable(MongoDB-testrunner ${TEST_SRCS} )
add_executable( ${TESTUNIT} ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME MongoDB WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND MongoDB-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoMongoDB PocoFoundation CppUnit ) target_link_libraries(MongoDB-testrunner PUBLIC Poco::MongoDB CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "Net")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,35 +6,35 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
# Windows and WindowsCE need additional libraries add_library(Net ${SRCS} )
if(WIN32) add_library(Poco::Net ALIAS Net)
if(WINCE) set_target_properties( Net
set(SYSLIBS ${SYSLIBS} "ws2.lib" "iphlpapi.lib")
else()
set(SYSLIBS ${SYSLIBS} "ws2_32.lib" "iphlpapi.lib")
endif()
endif(WIN32)
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoNet
DEFINE_SYMBOL Net_EXPORTS DEFINE_SYMBOL Net_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Foundation ${SYSLIBS}) target_link_libraries(Net PUBLIC Poco::Foundation)
target_include_directories( "${LIBNAME}" # 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()
endif(WIN32)
target_include_directories(Net
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(Net)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(Net)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "EchoServer") add_executable(EchoServer src/EchoServer.cpp)
target_link_libraries(EchoServer PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "HTTPFormServer") add_executable(HTTPFormServer src/HTTPFormServer.cpp)
target_link_libraries(HTTPFormServer PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "HTTPLoadTest") add_executable(HTTPLoadTest src/HTTPLoadTest.cpp)
target_link_libraries(HTTPLoadTest PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "HTTPTimeServer") add_executable(HTTPTimeServer src/HTTPTimeServer.cpp)
target_link_libraries(HTTPTimeServer PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Mail") add_executable(Mail src/Mail.cpp)
target_link_libraries(Mail PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Ping") add_executable(Ping src/Ping.cpp)
target_link_libraries(Ping PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "SMTPLogger") add_executable(SMTPLogger src/SMTPLogger.cpp)
target_link_libraries(SMTPLogger PUBLIC Poco::Net)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "TimeServer") add_executable(TimeServer src/TimeServer.cpp)
target_link_libraries(TimeServer PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,10 +1,5 @@
set(SAMPLE_NAME "WebSocketServer") add_executable(WebSocketServer src/WebSocketServer.cpp)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
if(WINCE) if(WINCE)
set_target_properties( ${SAMPLE_NAME} PROPERTIES LINK_FLAGS "/ENTRY:wmainCRTStartup") set_target_properties(WebSocketServer PROPERTIES LINK_FLAGS "/ENTRY:wmainCRTStartup")
endif() endif()
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) target_link_libraries(WebSocketServer PUBLIC Poco::Net Poco::Util Poco::JSON)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "dict") add_executable(dict src/dict.cpp)
target_link_libraries(dict PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "download") add_executable(download src/download.cpp)
target_link_libraries(download PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "httpget") add_executable(httpget src/httpget.cpp)
target_link_libraries(httpget PUBLIC Poco::Net Poco::Util Poco::JSON)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "ifconfig") add_executable(ifconfig src/ifconfig.cpp)
target_link_libraries(ifconfig PUBLIC Poco::Net)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,11 +14,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(Net-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME Net WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND Net-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoNet PocoUtil PocoXML PocoFoundation CppUnit) target_link_libraries(Net-testrunner PUBLIC Poco::Net Poco::Util Poco::XML CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "NetSSL")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,26 +6,25 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(NetSSL ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::NetSSL ALIAS NetSSL)
set_target_properties( "${LIBNAME}" set_target_properties( NetSSL
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoNetSSL
DEFINE_SYMBOL NetSSL_EXPORTS DEFINE_SYMBOL NetSSL_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Crypto Net Util Foundation ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ) target_link_libraries(NetSSL PUBLIC Poco::Crypto Poco::Net Poco::Util)
target_include_directories( "${LIBNAME}" target_include_directories(NetSSL
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(NetSSL)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(NetSSL)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "HTTPSTimeServer") add_executable(HTTPSTimeServer src/HTTPSTimeServer.cpp)
target_link_libraries(HTTPSTimeServer PUBLIC Poco::NetSSL Poco::Util Poco::XML)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Mail-ssl") add_executable(Mail-ssl src/Mail.cpp)
target_link_libraries(Mail-ssl PUBLIC Poco::NetSSL Poco::Util Poco::XML)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )

View File

@ -1,7 +1,5 @@
set(SAMPLE_NAME "TwitterCLient") add_executable(TwitterCLient
src/TweetApp.cpp
set(LOCAL_SRCS "") src/Twitter.cpp
aux_source_directory(src LOCAL_SRCS) )
target_link_libraries(TwitterCLient PUBLIC Poco::NetSSL Poco::Util Poco::JSON Poco::XML)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoJSON PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "download-ssl") add_executable(download-ssl src/download.cpp)
target_link_libraries(download-ssl PUBLIC Poco::NetSSL Poco::Util Poco::XML)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,18 +14,18 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(NetSSL-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) add_test(NAME NetSSL WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND NetSSL-testrunner -all)
# The test is run in the build directory. So the test data is copied there too # The test is run in the build directory. So the test data is copied there too
add_custom_command(TARGET ${TESTUNIT} POST_BUILD 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}/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}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTUNIT}.xml COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NetSSL-testrunner.xml
) )
endif() endif()
target_link_libraries( ${TESTUNIT} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation CppUnit) target_link_libraries(NetSSL-testrunner PUBLIC Poco::NetSSL Poco::Util Poco::XML CppUnit)

View File

@ -1,6 +1,3 @@
set(LIBNAME "NetSSLWin")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -9,26 +6,25 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
file(GLOB_RECURSE HDRS_G "include/*.h" ) file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G}) POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(NetSSLWin ${SRCS})
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::NetSSLWin ALIAS NetSSLWin)
set_target_properties( "${LIBNAME}" set_target_properties(NetSSLWin
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoNetSSLWin
DEFINE_SYMBOL NetSSL_Win_EXPORTS DEFINE_SYMBOL NetSSL_Win_EXPORTS
) )
target_link_libraries( "${LIBNAME}" Net Util Foundation Crypt32.lib ) target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util Crypt32.lib)
target_include_directories( "${LIBNAME}" target_include_directories(NetSSLWin
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") POCO_INSTALL(NetSSLWin)
POCO_GENERATE_PACKAGE("${LIBNAME}") POCO_GENERATE_PACKAGE(NetSSLWin)
if (ENABLE_TESTS) if (ENABLE_TESTS)
#TODO: Looks like the samples use crypto somehow? #TODO: Looks like the samples use crypto somehow?

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "HTTPSTimeServer-win") add_executable(HTTPSTimeServer-win src/HTTPSTimeServer.cpp)
target_link_libraries(HTTPSTimeServer-win PUBLIC Poco::NetSSLWin Poco::Crypto Poco::XML)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Mail-ssl-win") add_executable(Mail-ssl-win src/Mail.cpp)
target_link_libraries(Mail-ssl-win PUBLIC Poco::NetSSLWin Poco::Crypto Poco::XML)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )

View File

@ -1,7 +1,7 @@
set(SAMPLE_NAME "download-ssl-win") set(SAMPLE_NAME "")
set(LOCAL_SRCS "") set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS) aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) add_executable(download-ssl-win src/download.cpp)
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation ) target_link_libraries(download-ssl-win PUBLIC Poco::NetSSLWin Poco::Crypto Poco::XML)

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -16,13 +14,13 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
src/WinCEDriver.cpp src/WinCEDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(NetSSLWin-testrunner ${TEST_SRCS} )
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) add_test(NAME NetSSLWin WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND NetSSLWin-testrunner -all)
target_link_libraries( ${TESTUNIT} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation CppUnit) 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 # The test is run in the build directory. So the test data is copied there too
add_custom_command(TARGET ${TESTUNIT} POST_BUILD 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}/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}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTUNIT}.xml COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NetSSLWin.xml
) )

View File

@ -1,6 +1,3 @@
set(LIBNAME "PDF")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
@ -13,8 +10,6 @@ POCO_HEADERS_AUTO( SRCS ${HDRS_G})
# The configuration will fail if the packages are not found # The configuration will fail if the packages are not found
if (POCO_UNBUNDLED) if (POCO_UNBUNDLED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
else() else()
# zlib # zlib
POCO_SOURCES( SRCS zlib POCO_SOURCES( SRCS zlib
@ -121,26 +116,30 @@ POCO_SOURCES( SRCS libpng
#TODO: Can we put this with the below includes? PRIVAT eg. #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( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) add_library(PDF ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") add_library(Poco::PDF ALIAS PDF)
set_target_properties( "${LIBNAME}" set_target_properties(PDF
PROPERTIES PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME} OUTPUT_NAME PocoPDF
DEFINE_SYMBOL PDF_EXPORTS DEFINE_SYMBOL PDF_EXPORTS
) )
target_link_libraries( "${LIBNAME}" ${SYSLIBS} XML Util Foundation ) target_link_libraries(PDF PUBLIC ${ZLIB_LIBRARIES} Poco::XML Poco::Util)
target_include_directories( "${LIBNAME}" target_include_directories(PDF
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}") if (POCO_UNBUNDLED)
POCO_GENERATE_PACKAGE("${LIBNAME}") target_include_directories(PDF PUBLIC "${ZLIB_INCLUDE_DIRS}")
target_compile_definitions(PDF PUBLIC POCO_UNBUNDLED)
endif()
POCO_INSTALL(PDF)
POCO_GENERATE_PACKAGE(PDF)
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory(samples) add_subdirectory(samples)

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Image") add_executable(Image src/Image.cpp)
target_link_libraries(Image PUBLIC Poco::PDF)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoPDF PocoUtil PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Template") add_executable(Template src/Template.cpp)
target_link_libraries(Template PUBLIC Poco::PDF)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoPDF PocoUtil PocoXML PocoFoundation )

View File

@ -1,7 +1,2 @@
set(SAMPLE_NAME "Text") add_executable(Text src/Text.cpp)
target_link_libraries(Text PUBLIC Poco::PDF)
set(LOCAL_SRCS "")
aux_source_directory(src LOCAL_SRCS)
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
target_link_libraries( ${SAMPLE_NAME} PocoPDF PocoUtil PocoXML PocoFoundation )

View File

@ -1,5 +1,3 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
@ -12,11 +10,11 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF
src/WinDriver.cpp src/WinDriver.cpp
) )
add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_executable(PDF-testrunner ${TEST_SRCS} )
if(ANDROID) if(ANDROID)
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 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/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) 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() else()
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) add_test(NAME PDF WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND PDF-testrunner -all)
endif() endif()
target_link_libraries( ${TESTUNIT} PocoPDF PocoFoundation CppUnit ) target_link_libraries(PDF-testrunner PUBLIC Poco::PDF CppUnit )

View File

@ -4,16 +4,16 @@ set(POCO_EXENAME "PageCompiler")
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
add_executable( "${POCO_EXENAME}" ${SRCS} ) add_executable(PageCompiler ${SRCS} )
set_target_properties( "${POCO_EXENAME}" set_target_properties(PageCompiler
PROPERTIES PROPERTIES
OUTPUT_NAME cpspc OUTPUT_NAME cpspc
) )
target_link_libraries( "${POCO_EXENAME}" Net Util XML JSON Foundation) target_link_libraries(PageCompiler PUBLIC Poco::Net Poco::Util)
install( install(
TARGETS "${POCO_EXENAME}" EXPORT "${POCO_EXENAME}Targets" TARGETS PageCompiler EXPORT PageCompilerTargets
LIBRARY DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin

View File

@ -1,19 +1,17 @@
set(POCO_EXENAME "File2Page")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
add_executable( "${POCO_EXENAME}" ${SRCS} ) add_executable(File2Page ${SRCS} )
set_target_properties( "${POCO_EXENAME}" set_target_properties(File2Page
PROPERTIES PROPERTIES
OUTPUT_NAME f2cpsp OUTPUT_NAME f2cpsp
) )
target_link_libraries( "${POCO_EXENAME}" Net Util XML JSON Foundation) target_link_libraries(File2Page PUBLIC Poco::Util)
install( install(
TARGETS "${POCO_EXENAME}" EXPORT "${POCO_EXENAME}Targets" TARGETS File2Page EXPORT File2PageTargets
LIBRARY DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin

View File

@ -1,15 +1,13 @@
set(POCO_EXENAME "PocoDoc")
# Sources # Sources
file(GLOB SRCS_G "src/*.cpp") file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G}) POCO_SOURCES_AUTO( SRCS ${SRCS_G})
add_executable( "${POCO_EXENAME}" ${SRCS} ) add_executable(PocoDoc ${SRCS} )
target_link_libraries( "${POCO_EXENAME}" Util XML Foundation CppParser) target_link_libraries(PocoDoc PUBLIC Poco::Util Poco::XML Poco::CppParser)
install( install(
TARGETS "${POCO_EXENAME}" EXPORT "${POCO_EXENAME}Targets" TARGETS PocoDoc EXPORT PocoDocTargets
LIBRARY DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin

Some files were not shown because too many files have changed in this diff Show More