mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-27 00:35:23 +01:00
Merge cmake changes from develop (#2504)
* Increase PostgreSQL version number * Take changes from develop for Define Platform Specific cmake * Take changes from develop for find MySQL modul * Take changes from develop for find ODBC modul * Cleanup standard language compile features * Fix cmake compile features * Improve to find ODBC on windows * Enable 64-bit build on AppVeyor * Switch MySQL off on AppVeyor because of error LNK2038: mismatch detected for _MSC_VER: value 1800 doesnt match value 1900 * Move LCC define to MySQL
This commit is contained in:
parent
85b9fe7a21
commit
eec8dedbb8
@ -30,29 +30,29 @@ endif()
|
||||
#################################################################################
|
||||
# Setup C/C++ compiler options
|
||||
#################################################################################
|
||||
option(DISABLE_CPP11 "Disable C++11 if available" OFF)
|
||||
option(DISABLE_CPP14 "Disable C++14 if available" OFF)
|
||||
option(DISABLE_CPP11 "Disable C++11 if not available" OFF)
|
||||
option(DISABLE_CPP14 "Disable C++14 if not available" OFF)
|
||||
|
||||
if (DISABLE_CPP11 OR DISABLE_CPP14)
|
||||
add_definitions(-DPOCO_DISABLE_CPP11)
|
||||
|
||||
if (DISABLE_CPP14)
|
||||
add_definitions(-DPOCO_DISABLE_CPP14)
|
||||
endif()
|
||||
else()
|
||||
if(NOT DISABLE_CPP11 OR NOT DISABLE_CPP14)
|
||||
# C++11/14 compiler flags
|
||||
include(CXX1x)
|
||||
check_for_cxx11_compiler(CXX11_COMPILER)
|
||||
|
||||
# If a C++11 compiler is available, then set the appropriate flags
|
||||
if(CXX11_COMPILER)
|
||||
enable_cxx11()
|
||||
check_for_cxx14_compiler(CXX14_COMPILER)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
check_for_cxx14_compiler(CXX14_COMPILER)
|
||||
# If a C++14 compiler is available, then set the appropriate flags
|
||||
if(CXX14_COMPILER)
|
||||
enable_cxx14()
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
else()
|
||||
set(DISABLE_CPP14 ON CACHE BOOL "Disable C++14 if not available" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set(DISABLE_CPP11 ON CACHE BOOL "Disable C++11 if not available" FORCE)
|
||||
set(DISABLE_CPP14 ON CACHE BOOL "Disable C++14 if not available" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -44,21 +44,21 @@ if(MYSQL_FOUND AND ENABLE_DATA_MYSQL)
|
||||
message(STATUS "MySQL Support Enabled")
|
||||
add_subdirectory( MySQL )
|
||||
else()
|
||||
message(STATUS "MySQL Support Disabled - no MySQL library")
|
||||
message(STATUS "MySQL Support Disabled")
|
||||
endif()
|
||||
|
||||
if(POSTGRESQL_FOUND AND ENABLE_DATA_POSTGRESQL)
|
||||
message(STATUS "PostgreSQL Support Enabled")
|
||||
add_subdirectory( PostgreSQL )
|
||||
else()
|
||||
message(STATUS "PostgreSQL Support Disabled - no PostgreSQL library")
|
||||
message(STATUS "PostgreSQL Support Disabled")
|
||||
endif()
|
||||
|
||||
if(ODBC_FOUND AND ENABLE_DATA_ODBC AND NOT WINCE)
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else()
|
||||
message(STATUS "ODBC Support Disabled - no ODBC runtime")
|
||||
message(STATUS "ODBC Support Disabled")
|
||||
endif()
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
|
@ -24,6 +24,10 @@ target_include_directories(DataMySQL
|
||||
)
|
||||
target_compile_definitions(DataMySQL PUBLIC THREADSAFE NO_TCL)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(DataMySQL PUBLIC __LCC__) #__LCC__ define used by MySQL.h
|
||||
endif()
|
||||
|
||||
POCO_INSTALL(DataMySQL)
|
||||
POCO_GENERATE_PACKAGE(DataMySQL)
|
||||
|
||||
|
@ -105,7 +105,18 @@ target_include_directories(Foundation
|
||||
target_compile_definitions(Foundation
|
||||
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>
|
||||
)
|
||||
target_compile_features(Foundation
|
||||
PUBLIC
|
||||
$<$<NOT:$<BOOL:${DISABLE_CPP11}>>:cxx_defaulted_move_initializers>
|
||||
)
|
||||
if(NOT DISABLE_CPP14 AND CMAKE_VERSION VERSION_GREATER 3.7)
|
||||
target_compile_features(Foundation PUBLIC cxx_std_14)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(Foundation
|
||||
@ -115,7 +126,7 @@ if(NOT BUILD_SHARED_LIBS)
|
||||
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_compile_definitions(Foundation PUBLIC POCO_NO_AUTOMATIC_LIBS POCO_OS_FAMILY_WINDOWS UNICODE _UNICODE)
|
||||
target_link_libraries(Foundation PUBLIC iphlpapi)
|
||||
endif()
|
||||
|
||||
|
@ -5,5 +5,5 @@ install:
|
||||
|
||||
build_script:
|
||||
- set PATH=C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\bin;%PATH%
|
||||
- cmake -H. -Bcmake-build -DENABLE_DATA_POSTGRESQL=OFF
|
||||
- cmake -H. -Bcmake-build -G"Visual Studio 14 2015 Win64" -DODBC_ROOT_LIBRARY_DIRS="C:/Program Files/Microsoft SDKs/Windows/v7.0/Lib/x64" -DODBC_ROOT_INCLUDE_DIRS="C:/Program Files/Microsoft SDKs/Windows/v7.0/Include" -DENABLE_DATA_MYSQL=OFF
|
||||
- cmake --build cmake-build
|
||||
|
@ -42,13 +42,6 @@ macro(check_for_cxx11_compiler _VAR)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Sets the appropriate flag to enable C++11 support
|
||||
macro(enable_cxx11)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
add_definitions(-DPOCO_ENABLE_CPP11)
|
||||
endmacro()
|
||||
|
||||
# Determines whether the compiler supports C++14
|
||||
macro(check_for_cxx14_compiler _VAR)
|
||||
message(STATUS "Checking for C++14 compiler")
|
||||
@ -72,10 +65,3 @@ macro(check_for_cxx14_compiler _VAR)
|
||||
message(STATUS "Checking for C++14 compiler - unavailable")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Sets the appropriate flag to enable C++14 support
|
||||
macro(enable_cxx14)
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
add_definitions(-DPOCO_ENABLE_CPP14)
|
||||
endmacro()
|
||||
|
@ -40,11 +40,11 @@ if(MSVC)
|
||||
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)
|
||||
|
@ -40,14 +40,18 @@ find_path(MYSQL_INCLUDE_DIR mysql.h
|
||||
$ENV{MYSQL_INCLUDE_DIR}
|
||||
$ENV{MYSQL_DIR}/include
|
||||
$ENV{ProgramFiles}/MySQL/*/include
|
||||
${BINDIR32}/MySQL/include
|
||||
${BINDIR32}/MySQL/*/include
|
||||
$ENV{SystemDrive}/MySQL/*/include
|
||||
$ENV{MARIADB_INCLUDE_DIR}
|
||||
$ENV{MARIADB_DIR}/include
|
||||
${MARIADB_INCLUDE_DIR}
|
||||
${MARIADB_DIR}/include
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
mariadb
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(libsuffixDist debug)
|
||||
set(libsuffixBuild Debug)
|
||||
@ -59,17 +63,23 @@ if (WIN32)
|
||||
|
||||
find_library(MYSQL_LIBRARY NAMES mysqlclient
|
||||
HINTS
|
||||
${MYSQL_ROOT_DIR}/lib/${libsuffixDist}
|
||||
${MYSQL_ROOT_DIR}/lib
|
||||
${MYSQL_ROOT_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${PC_MYSQL_LIBRARY_DIRS}
|
||||
${PC_MARIADB_LIBRARY_DIRS}
|
||||
$ENV{MYSQL_DIR}/lib/${libsuffixDist}
|
||||
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
|
||||
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
||||
${BINDIR32}/MySQL/lib
|
||||
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
$ENV{MYSQL_DIR}/libmysql
|
||||
$ENV{MYSQL_DIR}/client
|
||||
$ENV{ProgramFiles}/MySQL/*/lib
|
||||
${BINDIR32}/MySQL/*/lib
|
||||
$ENV{SystemDrive}/MySQL/*/lib
|
||||
PATH_SUFFIXES
|
||||
vs12
|
||||
vs11
|
||||
vs10
|
||||
${libsuffixDist}
|
||||
${libsuffixBuild}
|
||||
)
|
||||
else()
|
||||
find_library(MYSQL_LIBRARY NAMES mysqlclient mysqlclient_r mariadbclient
|
||||
@ -85,6 +95,7 @@ else()
|
||||
/opt/mysql/mysql/lib
|
||||
$ENV{MYSQL_DIR}/libmysql_r/.libs
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
${MYSQL_DIR}/lib
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
mariadb
|
||||
|
@ -56,6 +56,12 @@ else()
|
||||
set(REQUIRED_INCLUDE_DIR ODBC_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WIN_ARCH x64)
|
||||
elseif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(WIN_ARCH x86)
|
||||
endif()
|
||||
|
||||
find_library(ODBC_LIBRARY
|
||||
NAMES unixodbc iodbc odbc odbc32
|
||||
HINTS
|
||||
@ -66,15 +72,15 @@ find_library(ODBC_LIBRARY
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/local/odbc/lib
|
||||
/usr/local/iodbc/lib
|
||||
"C:/Program Files/ODBC/lib"
|
||||
"C:/ODBC/lib/debug"
|
||||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"
|
||||
"${kit81_dir}/Lib/winv6.3/um/x64"
|
||||
"${kit_dir}/Lib/win8/um/x64"
|
||||
"${kit81_dir}/Lib/winv6.3/um/x86"
|
||||
"${kit_dir}/Lib/win8/um/x86"
|
||||
"${kit81_dir}/Lib/winv6.3/um"
|
||||
"${kit_dir}/Lib/win8/um"
|
||||
PATH_SUFIXES
|
||||
odbc
|
||||
${WIN_ARCH}
|
||||
DOC "Specify the ODBC driver manager library here."
|
||||
)
|
||||
|
||||
@ -86,8 +92,6 @@ endif()
|
||||
# List additional libraries required to use ODBC library
|
||||
if(WIN32 AND MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
set(_odbc_required_libs_names odbccp32;ws2_32)
|
||||
elseif(MINGW)
|
||||
set(_odbc_required_libs_names odbccp32)
|
||||
endif()
|
||||
foreach(_lib_name IN LISTS _odbc_required_libs_names)
|
||||
find_library(_lib_path
|
||||
@ -100,6 +104,7 @@ foreach(_lib_name IN LISTS _odbc_required_libs_names)
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/local/odbc/lib
|
||||
/usr/local/iodbc/lib
|
||||
"C:/Program Files/ODBC/lib"
|
||||
"C:/ODBC/lib/debug"
|
||||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib"
|
||||
|
@ -73,7 +73,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher
|
||||
|
||||
|
||||
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
|
||||
"9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
|
||||
"10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
|
||||
|
||||
# Define additional search paths for root directories.
|
||||
set( PostgreSQL_ROOT_DIRECTORIES
|
||||
|
Loading…
x
Reference in New Issue
Block a user