From 03423ddd04fc03a6eeffe168c3c1ed11ae933d28 Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Tue, 8 Dec 2015 09:58:35 +0100 Subject: [PATCH] Add SIMPLE_INSTALL macro, update FindSQL for Windows and DefinePlatformSpecific.cmake for Cygwin. Signed-off-by: FrancisANDRE --- cmake/DefinePlatformSpecifc.cmake | 43 +++++++++++++++++-------------- cmake/FindMySQL.cmake | 8 ++++-- cmake/PocoMacros.cmake | 31 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/cmake/DefinePlatformSpecifc.cmake b/cmake/DefinePlatformSpecifc.cmake index f3aed52c3..8937f34cd 100644 --- a/cmake/DefinePlatformSpecifc.cmake +++ b/cmake/DefinePlatformSpecifc.cmake @@ -48,6 +48,8 @@ if(MSVC) 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) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") endif(MSVC) # Add a d postfix to the debug libraries @@ -72,22 +74,27 @@ if(WIN32) add_definitions( -DUNICODE -D_UNICODE -D__LCC__) #__LCC__ define used by MySQL.h endif(WIN32) -if (UNIX AND NOT ANDROID ) - # 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 (CYGWIN) + add_definitions(-DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING) + add_definitions(-D_XOPEN_SOURCE=500 -D__BSD_VISIBLE) +else (CYGWIN) + if (UNIX AND NOT ANDROID ) + # 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 ) +endif (CYGWIN) if (CMAKE_SYSTEM MATCHES "SunOS") # Standard 'must be' defines @@ -100,10 +107,6 @@ if (CMAKE_COMPILER_IS_MINGW) 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) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index 64763d8bb..61c28b5c4 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -12,7 +12,8 @@ find_path(MYSQL_INCLUDE_DIR mysql.h $ENV{MYSQL_DIR}/include $ENV{ProgramFiles}/MySQL/*/include ${BINDIR32}/MySQL/include - $ENV{SystemDrive}/MySQL/*/include) + ${BINDIR32}/MySQL/*/include + $ENV{SystemDrive}/MySQL/*/include) if (WIN32) if (CMAKE_BUILD_TYPE STREQUAL Debug) @@ -24,13 +25,16 @@ if (WIN32) add_definitions(-DDBUG_OFF) endif (CMAKE_BUILD_TYPE STREQUAL Debug) - find_library(MYSQL_LIB NAMES mysqlclient + find_library(MYSQL_LIB NAMES mysqlclient.lib PATHS $ENV{MYSQL_DIR}/lib/${libsuffixDist} $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild} $ENV{MYSQL_DIR}/client/${libsuffixBuild} $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist} ${BINDIR32}/MySQL/lib + ${BINDIR32}/MySQL/*/lib/vs12 + ${BINDIR32}/MySQL/*/lib/vs11 + ${BINDIR32}/MySQL/*/lib/vs10 $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}) else (WIN32) find_library(MYSQL_LIB NAMES mysqlclient_r diff --git a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake index 5d42c6957..328add029 100644 --- a/cmake/PocoMacros.cmake +++ b/cmake/PocoMacros.cmake @@ -261,6 +261,37 @@ endif() endmacro() +#=============================================================================== +# Macros for simplified installation of package not following the Poco standard as CppUnit +# +# SIMPLE_INSTALL - Install the given target +# Usage: SIMPLE_INSTALL(target_name) +# INPUT: +# target_name the name of the target. e.g. CppUnit +# Example: SIMPLE_INSTALL(Foundation) +macro(SIMPLE_INSTALL target_name) +install( + DIRECTORY include + DESTINATION include + COMPONENT Devel + PATTERN ".svn" EXCLUDE + ) + +install( + TARGETS "${target_name}" EXPORT "${target_name}Targets" + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + 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: