Add SIMPLE_INSTALL macro, update FindSQL for Windows and

DefinePlatformSpecific.cmake for Cygwin.

Signed-off-by: FrancisANDRE <zosrothko@orange.fr>
This commit is contained in:
FrancisANDRE 2015-12-08 09:58:35 +01:00
parent 870cc4a648
commit 03423ddd04
3 changed files with 60 additions and 22 deletions

View File

@ -48,6 +48,8 @@ if(MSVC)
else(MSVC) else(MSVC)
# Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment # 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(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) endif(MSVC)
# Add a d postfix to the debug libraries # 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 add_definitions( -DUNICODE -D_UNICODE -D__LCC__) #__LCC__ define used by MySQL.h
endif(WIN32) endif(WIN32)
if (UNIX AND NOT ANDROID ) if (CYGWIN)
# Standard 'must be' defines add_definitions(-DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING)
if (APPLE) add_definitions(-D_XOPEN_SOURCE=500 -D__BSD_VISIBLE)
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64) else (CYGWIN)
set(SYSLIBS dl) if (UNIX AND NOT ANDROID )
else (APPLE) # Standard 'must be' defines
add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ) if (APPLE)
if (QNX) add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64)
add_definitions( -DPOCO_HAVE_FD_POLL) set(SYSLIBS dl)
set(SYSLIBS m socket) else (APPLE)
else (QNX) add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 )
add_definitions( -D_XOPEN_SOURCE=500 -DPOCO_HAVE_FD_EPOLL) if (QNX)
set(SYSLIBS pthread dl rt) add_definitions( -DPOCO_HAVE_FD_POLL)
endif (QNX) set(SYSLIBS m socket)
endif (APPLE) else (QNX)
endif(UNIX AND NOT ANDROID ) 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") if (CMAKE_SYSTEM MATCHES "SunOS")
# Standard 'must be' defines # 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) add_definitions(-D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE)
endif (CMAKE_COMPILER_IS_MINGW) endif (CMAKE_COMPILER_IS_MINGW)
if (CYGWIN)
# add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
endif (CYGWIN)
# SunPro C++ # SunPro C++
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
add_definitions( -D_BSD_SOURCE -library=stlport4) add_definitions( -D_BSD_SOURCE -library=stlport4)

View File

@ -12,7 +12,8 @@ find_path(MYSQL_INCLUDE_DIR mysql.h
$ENV{MYSQL_DIR}/include $ENV{MYSQL_DIR}/include
$ENV{ProgramFiles}/MySQL/*/include $ENV{ProgramFiles}/MySQL/*/include
${BINDIR32}/MySQL/include ${BINDIR32}/MySQL/include
$ENV{SystemDrive}/MySQL/*/include) ${BINDIR32}/MySQL/*/include
$ENV{SystemDrive}/MySQL/*/include)
if (WIN32) if (WIN32)
if (CMAKE_BUILD_TYPE STREQUAL Debug) if (CMAKE_BUILD_TYPE STREQUAL Debug)
@ -24,13 +25,16 @@ if (WIN32)
add_definitions(-DDBUG_OFF) add_definitions(-DDBUG_OFF)
endif (CMAKE_BUILD_TYPE STREQUAL Debug) endif (CMAKE_BUILD_TYPE STREQUAL Debug)
find_library(MYSQL_LIB NAMES mysqlclient find_library(MYSQL_LIB NAMES mysqlclient.lib
PATHS PATHS
$ENV{MYSQL_DIR}/lib/${libsuffixDist} $ENV{MYSQL_DIR}/lib/${libsuffixDist}
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild} $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
$ENV{MYSQL_DIR}/client/${libsuffixBuild} $ENV{MYSQL_DIR}/client/${libsuffixBuild}
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist} $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
${BINDIR32}/MySQL/lib ${BINDIR32}/MySQL/lib
${BINDIR32}/MySQL/*/lib/vs12
${BINDIR32}/MySQL/*/lib/vs11
${BINDIR32}/MySQL/*/lib/vs10
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}) $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
else (WIN32) else (WIN32)
find_library(MYSQL_LIB NAMES mysqlclient_r find_library(MYSQL_LIB NAMES mysqlclient_r

View File

@ -261,6 +261,37 @@ endif()
endmacro() 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) # POCO_INSTALL_PDB - Install the given target's companion pdb file (if present)
# Usage: POCO_INSTALL_PDB(target_name) # Usage: POCO_INSTALL_PDB(target_name)
# INPUT: # INPUT: