2014-08-22 17:10:24 +02:00
|
|
|
# Sources
|
|
|
|
file(GLOB SRCS_G "src/*.cpp")
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES_AUTO(SRCS ${SRCS_G})
|
2014-07-09 15:52:54 +02:00
|
|
|
|
2014-08-22 17:10:24 +02:00
|
|
|
# Headers
|
2020-02-14 11:07:32 +01:00
|
|
|
file(GLOB_RECURSE HDRS_G "include/*.h")
|
|
|
|
POCO_HEADERS_AUTO(SRCS ${HDRS_G})
|
2014-08-22 17:10:24 +02:00
|
|
|
|
|
|
|
# Platform Specific
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES_AUTO_PLAT(SRCS UNIX src/SyslogChannel.cpp)
|
|
|
|
POCO_HEADERS_AUTO(SRCS include/Poco/SyslogChannel.h)
|
2014-08-22 17:10:24 +02:00
|
|
|
|
2014-10-09 13:42:51 +02:00
|
|
|
# For Windows CE we need to disable these
|
|
|
|
if(WINCE)
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES_AUTO_PLAT(SRCS OFF
|
2015-09-26 11:11:23 +02:00
|
|
|
src/WindowsConsoleChannel.cpp
|
|
|
|
src/EventLogChannel.cpp
|
|
|
|
)
|
2014-10-09 13:42:51 +02:00
|
|
|
else()
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES_AUTO_PLAT(SRCS WIN32
|
2015-09-26 11:11:23 +02:00
|
|
|
src/WindowsConsoleChannel.cpp
|
|
|
|
src/EventLogChannel.cpp
|
|
|
|
)
|
2014-10-09 13:42:51 +02:00
|
|
|
endif()
|
2014-08-22 17:10:24 +02:00
|
|
|
|
2019-06-24 15:39:06 +02:00
|
|
|
# Version Resource
|
2020-02-12 22:10:01 +01:00
|
|
|
if(MSVC AND BUILD_SHARED_LIBS)
|
2020-02-14 11:07:32 +01:00
|
|
|
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
|
|
|
list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
2019-06-24 15:39:06 +02:00
|
|
|
endif()
|
|
|
|
|
2014-08-22 17:10:24 +02:00
|
|
|
# Messages
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_MESSAGES(SRCS Logging src/pocomsg.mc)
|
2012-11-11 11:28:44 +01:00
|
|
|
|
2014-07-09 15:52:54 +02:00
|
|
|
# If POCO_UNBUNDLED is enabled we try to find the required packages
|
|
|
|
# The configuration will fail if the packages are not found
|
2020-02-14 11:07:32 +01:00
|
|
|
if(POCO_UNBUNDLED)
|
2015-09-26 11:11:23 +02:00
|
|
|
find_package(PCRE REQUIRED)
|
2018-06-03 18:17:50 +02:00
|
|
|
find_package(ZLIB REQUIRED)
|
2015-09-26 11:11:23 +02:00
|
|
|
|
|
|
|
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES(SRCS RegExp
|
2015-09-26 11:11:23 +02:00
|
|
|
src/pcre_ucd.c
|
|
|
|
src/pcre_tables.c
|
|
|
|
)
|
|
|
|
|
2014-07-09 15:52:54 +02:00
|
|
|
else()
|
2015-09-26 11:11:23 +02:00
|
|
|
# pcre
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES(SRCS pcre
|
2015-09-26 11:11:23 +02:00
|
|
|
src/pcre_config.c
|
|
|
|
src/pcre_byte_order.c
|
|
|
|
src/pcre_chartables.c
|
|
|
|
src/pcre_compile.c
|
|
|
|
src/pcre_exec.c
|
|
|
|
src/pcre_fullinfo.c
|
|
|
|
src/pcre_globals.c
|
|
|
|
src/pcre_maketables.c
|
|
|
|
src/pcre_newline.c
|
|
|
|
src/pcre_ord2utf8.c
|
|
|
|
src/pcre_study.c
|
|
|
|
src/pcre_tables.c
|
|
|
|
src/pcre_dfa_exec.c
|
|
|
|
src/pcre_get.c
|
|
|
|
src/pcre_jit_compile.c
|
|
|
|
src/pcre_refcount.c
|
|
|
|
src/pcre_string_utils.c
|
|
|
|
src/pcre_version.c
|
|
|
|
src/pcre_ucd.c
|
|
|
|
src/pcre_valid_utf8.c
|
|
|
|
src/pcre_xclass.c
|
|
|
|
)
|
|
|
|
|
|
|
|
# zlib
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_HEADERS(SRCS zlib
|
2015-09-26 11:11:23 +02:00
|
|
|
include/Poco/zconf.h
|
|
|
|
include/Poco/zlib.h
|
|
|
|
)
|
|
|
|
|
2020-02-14 11:07:32 +01:00
|
|
|
POCO_SOURCES(SRCS zlib
|
2015-09-26 11:11:23 +02:00
|
|
|
src/adler32.c
|
|
|
|
src/compress.c
|
|
|
|
src/crc32.c
|
|
|
|
src/deflate.c
|
|
|
|
src/infback.c
|
|
|
|
src/inffast.c
|
|
|
|
src/inflate.c
|
|
|
|
src/inftrees.c
|
|
|
|
src/trees.c
|
|
|
|
src/zutil.c
|
|
|
|
)
|
2020-02-14 11:07:32 +01:00
|
|
|
endif(POCO_UNBUNDLED)
|
2014-07-09 15:52:54 +02:00
|
|
|
|
2018-06-03 18:17:50 +02:00
|
|
|
|
|
|
|
add_library(Foundation ${SRCS})
|
|
|
|
add_library(Poco::Foundation ALIAS Foundation)
|
|
|
|
set_target_properties(Foundation
|
2015-09-26 11:11:23 +02:00
|
|
|
PROPERTIES
|
|
|
|
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
2018-06-03 18:17:50 +02:00
|
|
|
OUTPUT_NAME PocoFoundation
|
2015-09-26 11:11:23 +02:00
|
|
|
DEFINE_SYMBOL Foundation_EXPORTS
|
2020-02-14 11:07:32 +01:00
|
|
|
)
|
2014-10-09 13:42:51 +02:00
|
|
|
|
2020-02-14 11:07:32 +01:00
|
|
|
if(POCO_UNBUNDLED)
|
|
|
|
target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB)
|
|
|
|
target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED)
|
|
|
|
endif(POCO_UNBUNDLED)
|
2019-04-22 23:47:11 +02:00
|
|
|
|
2018-06-03 18:17:50 +02:00
|
|
|
target_include_directories(Foundation
|
2015-09-26 11:11:23 +02:00
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
2020-02-14 11:07:32 +01:00
|
|
|
)
|
2012-11-11 11:28:44 +01:00
|
|
|
|
2018-06-03 18:17:50 +02:00
|
|
|
target_compile_definitions(Foundation
|
2020-02-14 11:07:32 +01:00
|
|
|
PUBLIC
|
|
|
|
$<$<CONFIG:Debug>:_DEBUG>
|
|
|
|
$<$<BOOL:${DISABLE_CPP14}>:POCO_DISABLE_CPP14>
|
|
|
|
$<$<NOT:$<BOOL:${DISABLE_CPP14}>>:POCO_ENABLE_CPP14>
|
|
|
|
$<$<BOOL:${DISABLE_CPP11}>:POCO_DISABLE_CPP11>
|
|
|
|
$<$<NOT:$<BOOL:${DISABLE_CPP11}>>:POCO_ENABLE_CPP11>
|
2018-06-03 18:17:50 +02:00
|
|
|
)
|
2018-10-18 07:07:46 +02:00
|
|
|
target_compile_features(Foundation
|
2020-02-14 11:07:32 +01:00
|
|
|
PUBLIC
|
|
|
|
$<$<NOT:$<BOOL:${DISABLE_CPP11}>>:cxx_defaulted_move_initializers>
|
2018-10-18 07:07:46 +02:00
|
|
|
)
|
2019-04-08 13:11:30 +02:00
|
|
|
if(NOT DISABLE_CPP14 AND CMAKE_VERSION VERSION_GREATER "3.8")
|
2020-02-14 11:07:32 +01:00
|
|
|
target_compile_features(Foundation PUBLIC cxx_std_14)
|
2018-10-18 07:07:46 +02:00
|
|
|
endif()
|
2018-06-03 18:17:50 +02:00
|
|
|
|
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
2020-02-14 11:07:32 +01:00
|
|
|
target_compile_definitions(Foundation
|
|
|
|
PUBLIC
|
|
|
|
POCO_STATIC
|
|
|
|
)
|
2018-06-03 18:17:50 +02:00
|
|
|
endif()
|
2019-06-24 15:39:06 +02:00
|
|
|
|
2018-06-03 18:17:50 +02:00
|
|
|
if(WIN32)
|
2019-08-13 09:43:17 +02:00
|
|
|
target_compile_definitions(Foundation PUBLIC POCO_OS_FAMILY_WINDOWS UNICODE _UNICODE)
|
2018-06-03 18:17:50 +02:00
|
|
|
target_link_libraries(Foundation PUBLIC iphlpapi)
|
|
|
|
endif()
|
|
|
|
|
2020-02-14 11:07:32 +01:00
|
|
|
if(CYGWIN)
|
|
|
|
target_compile_definitions(Foundation PUBLIC POCO_NO_FPENVIRONMENT POCO_NO_WSTRING _XOPEN_SOURCE=500 __BSD_VISIBLE)
|
2018-10-10 13:48:08 +02:00
|
|
|
else()
|
2020-02-14 11:07:32 +01:00
|
|
|
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})
|
2018-10-10 13:48:08 +02:00
|
|
|
else()
|
2020-02-14 11:07:32 +01:00
|
|
|
target_compile_definitions(Foundation PUBLIC _REENTRANT _THREAD_SAFE _LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64)
|
|
|
|
if(QNX)
|
|
|
|
target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL)
|
|
|
|
target_link_libraries(Foundation PUBLIC m socket)
|
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
|
|
|
target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL)
|
|
|
|
target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt)
|
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "AIX")
|
|
|
|
target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_POLL)
|
|
|
|
target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt)
|
|
|
|
else()
|
|
|
|
target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_EPOLL)
|
|
|
|
target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt)
|
|
|
|
endif()
|
|
|
|
endif(APPLE)
|
|
|
|
endif(UNIX AND NOT ANDROID)
|
|
|
|
endif(CYGWIN)
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM MATCHES "SunOS")
|
|
|
|
target_compile_definitions(Foundation
|
|
|
|
PUBLIC
|
|
|
|
POCO_OS_FAMILY_UNIX
|
|
|
|
_XOPEN_SOURCE=500
|
|
|
|
_REENTRANT
|
|
|
|
_THREAD_SAFE
|
|
|
|
_LARGEFILE64_SOURCE
|
|
|
|
_FILE_OFFSET_BITS=64
|
2018-06-03 18:17:50 +02:00
|
|
|
)
|
2020-02-14 11:07:32 +01:00
|
|
|
target_link_libraries(Foundation PUBLIC pthread socket xnet nsl resolv rt ${CMAKE_DL_LIBS})
|
2018-06-03 18:17:50 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_MINGW)
|
2020-02-14 11:07:32 +01:00
|
|
|
target_compile_definitions(Foundation
|
|
|
|
PUBLIC
|
|
|
|
WC_NO_BEST_FIT_CHARS=0x400
|
|
|
|
POCO_WIN32_UTF8
|
|
|
|
_WIN32
|
|
|
|
MINGW32
|
|
|
|
WINVER=0x500
|
|
|
|
ODBCVER=0x0300
|
|
|
|
POCO_THREAD_STACK_SIZE
|
2018-06-03 18:17:50 +02:00
|
|
|
)
|
|
|
|
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
|
2020-02-14 11:07:32 +01:00
|
|
|
if(IOS)
|
|
|
|
target_compile_definitions(Foundation
|
|
|
|
PUBLIC
|
|
|
|
POCO_HAVE_IPv6
|
|
|
|
POCO_NO_FPENVIRONMENT
|
|
|
|
POCO_NO_STAT64
|
|
|
|
POCO_NO_SHAREDLIBS
|
|
|
|
POCO_NO_NET_IFTYPES
|
2018-06-03 18:17:50 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#Android
|
2020-02-14 11:07:32 +01:00
|
|
|
if(ANDROID)
|
2018-06-03 18:17:50 +02:00
|
|
|
target_compile_definitions(Foundation
|
|
|
|
PUBLIC
|
|
|
|
POCO_NO_FPENVIRONMENT
|
|
|
|
POCO_NO_WSTRING
|
|
|
|
POCO_NO_SHAREDMEMORY
|
|
|
|
)
|
|
|
|
target_link_libraries(Foundation PUBLIC log)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
POCO_INSTALL(Foundation)
|
|
|
|
POCO_GENERATE_PACKAGE(Foundation)
|
2014-10-09 13:42:51 +02:00
|
|
|
|
2020-02-14 11:07:32 +01:00
|
|
|
if(ENABLE_TESTS)
|
2020-02-12 22:10:01 +01:00
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
2020-02-14 11:07:32 +01:00
|
|
|
set_property(TARGET Foundation PROPERTY POSITION_INDEPENDENT_CODE ON) # This is needed to build TestLibrary.so as shared.
|
2018-09-22 12:02:05 +02:00
|
|
|
endif()
|
2018-06-03 18:17:50 +02:00
|
|
|
add_subdirectory(samples)
|
|
|
|
add_subdirectory(testsuite)
|
2020-02-14 11:07:32 +01:00
|
|
|
endif()
|