integrated CMake improvements from develop (GH #946)

This commit is contained in:
Guenter Obiltschnig 2015-09-26 11:11:23 +02:00
parent 4e375945f9
commit e25a17030d
25 changed files with 324 additions and 145 deletions

View File

@ -6,14 +6,14 @@
# ENABLE_{COMPONENT}
# ENABLE_TESTS
project(Poco)
cmake_minimum_required(VERSION 3.0.0)
file(STRINGS "${CMAKE_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION)
project(Poco)
file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION)
# Read the version information from the VERSION file
file (STRINGS "${CMAKE_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_MINOR ${PACKAGE_VERSION})
@ -35,6 +35,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Append our module directory to CMake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# COMMENT REPLACED BY BIICODE
#################################################################################
# Setup C/C++ compiler options
#################################################################################
@ -49,20 +51,7 @@ endif()
if (CMAKE_BUILD_TYPE STREQUAL "")
set( CMAKE_BUILD_TYPE "RelWithDebInfo" )
endif ()
# http://www.cmake.org/Wiki/CMake_Useful_Variables :
# CMAKE_BUILD_TYPE
# Choose the type of build. CMake has default flags for these:
#
# * None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used)
# * Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG)
# * Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)
# * RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO
# * MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)
# For Debug build types, append a "d" to the library names.
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE)
endif()
# Include some common macros to simpilfy the Poco CMake files
include(PocoMacros)
@ -100,13 +89,22 @@ option(POCO_STATIC
option(POCO_UNBUNDLED
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
# Uncomment from next two lines to force statitc or dynamic library, default is autodetection
if(MSVC)
option(POCO_MT
"Set to OFF|ON (default is OFF) to control build of POCO as /MT instead of /MD" OFF)
option(ENABLE_MSVC_MP
"Set to OFF|ON (default is OFF) to control parallel build of POCO with MSVC" OFF)
endif()
# Uncomment from next two lines to force static or dynamic library, default is autodetection
if(POCO_STATIC)
add_definitions( -DPOCO_STATIC -DPOCO_NO_AUTOMATIC_LIBS)
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)
@ -125,58 +123,7 @@ else ()
message(STATUS "Build with using internal copy of sqlite, libz, pcre, expat, ...")
endif ()
include(CheckTypeSize)
find_package(Cygwin)
# OS Detection
if(WIN32)
add_definitions( -DPOCO_OS_FAMILY_WINDOWS -DUNICODE -D_UNICODE)
#set(SYSLIBS iphlpapi gdi32 odbc32)
endif(WIN32)
if (UNIX AND NOT ANDROID )
add_definitions( -DPOCO_OS_FAMILY_UNIX )
# Standard 'must be' defines
if (APPLE)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64)
set(SYSLIBS dl)
else (APPLE)
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
set(SYSLIBS pthread dl rt)
endif (APPLE)
endif(UNIX AND NOT ANDROID )
if (CMAKE_SYSTEM MATCHES "SunOS")
add_definitions( -DPOCO_OS_FAMILY_UNIX )
# Standard 'must be' defines
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 )
set(SYSLIBS pthread socket xnet nsl resolv rt dl)
endif(CMAKE_SYSTEM MATCHES "SunOS")
if (CMAKE_COMPILER_IS_MINGW)
add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
add_definitions(-D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE)
endif (CMAKE_COMPILER_IS_MINGW)
if (CYGWIN)
# add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
endif (CYGWIN)
# SunPro C++
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
add_definitions( -D_BSD_SOURCE -library=stlport4)
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
# iOS
if (IOS)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES )
endif(IOS)
#Android
if (ANDROID)
add_definitions( -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY )
endif(ANDROID)
include(DefinePlatformSpecifc)
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
set(Poco_COMPONENTS "")
@ -328,7 +275,17 @@ message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} u
message(STATUS "Installation target path: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "C_FLAGS: =${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_C_FLAGS_DEBUG:=${CMAKE_C_FLAGS_DEBUG}")
message(STATUS "CMAKE_C_FLAGS_RELEASE:=${CMAKE_C_FLAGS_RELEASE}")
message(STATUS "CMAKE_C_FLAGS_MINSIZEREL:=${CMAKE_C_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_C_FLAGS_RELWITHDEBINFO:=${CMAKE_C_FLAGS_RELWITHDEBINFO}")
message(STATUS "")
message(STATUS "")
message(STATUS "CXX_FLAGS:=${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS_DEBUG:=${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE:=${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL:=${CMAKE_CXX_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO:=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
foreach(component ${Poco_COMPONENTS})
message(STATUS "Building: ${component}")

View File

@ -25,6 +25,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -20,3 +20,4 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})

View File

@ -27,6 +27,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
if(WIN32)
target_link_libraries( ${LIBNAME} winmm )

View File

@ -27,6 +27,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -34,6 +34,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -27,6 +27,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -27,6 +27,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -48,6 +48,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -19,14 +19,14 @@ POCO_HEADERS_AUTO( SRCS include/Poco/SyslogChannel.h )
# For Windows CE we need to disable these
if(WINCE)
POCO_SOURCES_AUTO_PLAT( SRCS OFF
src/WindowsConsoleChannel.cpp
src/EventLogChannel.cpp
)
src/WindowsConsoleChannel.cpp
src/EventLogChannel.cpp
)
else()
POCO_SOURCES_AUTO_PLAT( SRCS WIN32
src/WindowsConsoleChannel.cpp
src/EventLogChannel.cpp
)
src/WindowsConsoleChannel.cpp
src/EventLogChannel.cpp
)
endif()
# Messages
@ -35,97 +35,143 @@ POCO_MESSAGES( SRCS Logging src/pocomsg.mc)
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if (POCO_UNBUNDLED)
find_package(PCRE REQUIRED)
set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES})
include_directories(${PCRE_INCLUDE_DIRS})
find_package(PCRE REQUIRED)
set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES})
include_directories(${PCRE_INCLUDE_DIRS})
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
POCO_SOURCES( SRCS RegExp
src/pcre_ucd.c
src/pcre_tables.c
)
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
POCO_SOURCES( SRCS RegExp
src/pcre_ucd.c
src/pcre_tables.c
)
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
else()
# pcre
POCO_SOURCES( SRCS pcre
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
)
# pcre
POCO_SOURCES( SRCS pcre
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
POCO_HEADERS( SRCS zlib
include/Poco/zconf.h
include/Poco/zlib.h
)
# zlib
POCO_HEADERS( SRCS zlib
include/Poco/zconf.h
include/Poco/zlib.h
)
POCO_SOURCES( SRCS zlib
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
)
POCO_SOURCES( SRCS zlib
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
)
endif (POCO_UNBUNDLED)
if(WIN32)
set(SYSLIBS ${SYSLIBS} iphlpapi)
set(SYSLIBS ${SYSLIBS} iphlpapi)
endif(WIN32)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
set_target_properties( "${LIBNAME}" PROPERTIES LINK_FLAGS "-library=stlport4")
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}"
PROPERTIES
VERSION ${PROJECT_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME}
DEFINE_SYMBOL Foundation_EXPORTS
)
PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME}
DEFINE_SYMBOL Foundation_EXPORTS
)
target_link_libraries( "${LIBNAME}" ${SYSLIBS})
target_include_directories( "${LIBNAME}"
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
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}")
if (ENABLE_TESTS)
add_subdirectory( samples )
add_subdirectory( testsuite )
add_subdirectory( samples )
add_subdirectory( testsuite )
endif ()

View File

@ -1,5 +1,6 @@
add_subdirectory(ActiveMethod)
add_subdirectory(Activity)
add_subdirectory(Benchmark)
add_subdirectory(BinaryReaderWriter)
add_subdirectory(DateTime)
add_subdirectory(LogRotation)

View File

@ -25,6 +25,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -25,6 +25,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -34,6 +34,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -25,6 +25,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -25,6 +25,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -130,6 +130,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -66,6 +66,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -42,6 +42,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -48,6 +48,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -2,4 +2,5 @@ add_subdirectory(DOMParser)
add_subdirectory(DOMWriter)
add_subdirectory(PrettyPrint)
add_subdirectory(SAXParser)
#add_subdirectory(RoundTrip)

View File

@ -25,6 +25,7 @@ target_include_directories( "${LIBNAME}"
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})
POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")

View File

@ -0,0 +1,122 @@
# http://www.cmake.org/Wiki/CMake_Useful_Variables :
# CMAKE_BUILD_TYPE
# Choose the type of build. CMake has default flags for these:
#
# * None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used)
# * Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG)
# * Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)
# * RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO
# * MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)
# Setting CXX Flag /MD or /MT and POSTFIX values i.e MDd / MD / MTd / MT / d
#
# For visual studio the library naming is as following:
# Dynamic libraries:
# - PocoX.dll for release library
# - PocoXd.dll for debug library
#
# Static libraries:
# - PocoXmd.lib for /MD release build
# - PocoXtmt.lib for /MT release build
#
# - PocoXmdd.lib for /MD debug build
# - PocoXmtd.lib for /MT debug build
if(MSVC)
if(POCO_MT)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE)
else(POCO_MT)
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
endif(POCO_MT)
if (ENABLE_MSVC_MP)
add_definitions(/MP)
endif()
else(MSVC)
# Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment
set(STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE)
endif(MSVC)
# Add a d postfix to the debug libraries
if(POCO_STATIC)
set(CMAKE_DEBUG_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set Debug library postfix" FORCE)
set(CMAKE_RELEASE_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set Release library postfix" FORCE)
set(CMAKE_MINSIZEREL_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set MinSizeRel library postfix" FORCE)
set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
else(POCO_STATIC)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE)
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set Release library postfix" FORCE)
set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "Set MinSizeRel library postfix" FORCE)
set(CMAKE_RELWITHDEBINFO_POSTFIX "d" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
endif()
# OS Detection
include(CheckTypeSize)
find_package(Cygwin)
if(WIN32)
add_definitions( -DPOCO_OS_FAMILY_WINDOWS -DUNICODE -D_UNICODE -D__LCC__) #__LCC__ define used by MySQL.h
endif(WIN32)
if (UNIX AND NOT ANDROID )
add_definitions( -DPOCO_OS_FAMILY_UNIX )
# Standard 'must be' defines
if (APPLE)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64)
set(SYSLIBS dl)
else (APPLE)
add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 )
if (QNX)
add_definitions( -DPOCO_HAVE_FD_POLL)
set(SYSLIBS m socket)
else (QNX)
add_definitions( -D_XOPEN_SOURCE=500 -DPOCO_HAVE_FD_EPOLL)
set(SYSLIBS pthread dl rt)
endif (QNX)
endif (APPLE)
endif(UNIX AND NOT ANDROID )
if (CMAKE_SYSTEM MATCHES "SunOS")
add_definitions( -DPOCO_OS_FAMILY_UNIX )
# Standard 'must be' defines
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 )
set(SYSLIBS pthread socket xnet nsl resolv rt dl)
endif(CMAKE_SYSTEM MATCHES "SunOS")
if (CMAKE_COMPILER_IS_MINGW)
add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
add_definitions(-D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE)
endif (CMAKE_COMPILER_IS_MINGW)
if (CYGWIN)
# add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
endif (CYGWIN)
# SunPro C++
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
add_definitions( -D_BSD_SOURCE -library=stlport4)
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
# iOS
if (IOS)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES )
endif(IOS)
#Android
if (ANDROID)
add_definitions( -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY )
endif(ANDROID)

View File

@ -1,3 +1,6 @@
SET(BINDIR32_ENV_NAME "ProgramFiles(x86)")
SET(BINDIR32 $ENV{${BINDIR32_ENV_NAME}})
find_path(MYSQL_INCLUDE_DIR mysql.h
/usr/include/mysql
/usr/local/include/mysql
@ -8,6 +11,7 @@ find_path(MYSQL_INCLUDE_DIR mysql.h
$ENV{MYSQL_INCLUDE_DIR}
$ENV{MYSQL_DIR}/include
$ENV{ProgramFiles}/MySQL/*/include
${BINDIR32}/MySQL/include
$ENV{SystemDrive}/MySQL/*/include)
if (WIN32)
@ -26,6 +30,7 @@ if (WIN32)
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
${BINDIR32}/MySQL/lib
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
else (WIN32)
find_library(MYSQL_LIB NAMES mysqlclient_r

View File

@ -16,15 +16,18 @@ if (WIN32)
# be set up anyway
get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
if (X64)
set(sdk_bindir "${sdk_dir}/bin/x64")
set(kit_bindir "${kit_dir}/bin/x64")
set(kit81_bindir "${kit81_dir}/bin/x64")
else (X64)
set(sdk_bindir "${sdk_dir}/bin")
set(kit_bindir "${kit_dir}/bin/x86")
set(kit81_bindir "${kit81_dir}/bin/x86")
endif (X64)
endif ()
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}"
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}"
DOC "path to message compiler")
if (NOT CMAKE_MC_COMPILER)
message(FATAL_ERROR "message compiler not found: required to build")
@ -250,4 +253,30 @@ install(
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
if (MSVC)
# install the targets pdb
POCO_INSTALL_PDB(${target_name})
endif()
endmacro()
# POCO_INSTALL_PDB - Install the given target's companion pdb file (if present)
# Usage: POCO_INSTALL_PDB(target_name)
# INPUT:
# target_name the name of the target. e.g. Foundation for PocoFoundation
# Example: POCO_INSTALL_PDB(Foundation)
#
# This is an internal macro meant only to be used by POCO_INSTALL.
macro(POCO_INSTALL_PDB target_name)
get_property(type TARGET ${target_name} PROPERTY TYPE)
if ("${type}" STREQUAL "SHARED_LIBRARY" OR "${type}" STREQUAL "EXECUTABLE")
install(
FILES $<TARGET_PDB_FILE:${target_name}>
DESTINATION bin
COMPONENT Devel
OPTIONAL
)
endif()
endmacro()