mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-29 04:06:51 +01:00
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:
committed by
Aleksandar Fabijanic
parent
4542a15b86
commit
612f092235
@@ -1,6 +1,3 @@
|
||||
set(LIBNAME "Foundation")
|
||||
set(POCO_LIBNAME "Poco${LIBNAME}")
|
||||
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
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
|
||||
if (POCO_UNBUNDLED)
|
||||
find_package(PCRE REQUIRED)
|
||||
set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES})
|
||||
include_directories(${PCRE_INCLUDE_DIRS})
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
|
||||
POCO_SOURCES( SRCS RegExp
|
||||
@@ -42,12 +38,6 @@ if (POCO_UNBUNDLED)
|
||||
src/pcre_tables.c
|
||||
)
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
add_definitions(-DPOCO_UNBUNDLED)
|
||||
|
||||
else()
|
||||
# pcre
|
||||
POCO_SOURCES( SRCS pcre
|
||||
@@ -94,84 +84,127 @@ else()
|
||||
)
|
||||
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)
|
||||
set(SYSLIBS ${SYSLIBS} log)
|
||||
endif(ANDROID)
|
||||
|
||||
# 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}"
|
||||
add_library(Foundation ${SRCS})
|
||||
add_library(Poco::Foundation ALIAS Foundation)
|
||||
set_target_properties(Foundation
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
||||
OUTPUT_NAME ${POCO_LIBNAME}
|
||||
OUTPUT_NAME PocoFoundation
|
||||
DEFINE_SYMBOL Foundation_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries( "${LIBNAME}" ${SYSLIBS})
|
||||
target_include_directories( "${LIBNAME}"
|
||||
target_link_libraries(Foundation PUBLIC ${PCRE_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
target_include_directories(Foundation
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
|
||||
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
target_compile_definitions(Foundation
|
||||
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)
|
||||
add_subdirectory( samples )
|
||||
add_subdirectory( testsuite )
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user