Fix cmake build on FreeBSD (#2476)

* Fix cmake build on FreeBSD
This commit is contained in:
Joerg-Christian Boehme 2018-10-10 13:48:08 +02:00 committed by GitHub
parent e624b3315c
commit 85b9fe7a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 17 deletions

View File

@ -12,8 +12,6 @@ string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_
set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set(RELEASE_NAME "Unstable-trunk")
message(STATUS "Poco package version: ${PROJECT_VERSION}")
# Put the libaries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf
# directories. This simplifies manual testing and the use of the build
@ -61,7 +59,6 @@ endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
message(STATUS "Setting Poco build type - ${CMAKE_BUILD_TYPE}")
# Include some common macros to simpilfy the Poco CMake files
include(PocoMacros)
@ -105,10 +102,10 @@ endif()
if(MYSQL_FOUND)
option(ENABLE_DATA "Enable Data" ON)
option(ENABLE_DATA_MYSQL "Enable Data MySQL" ON)
option(ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" ON)
else()
option(ENABLE_DATA "Enable Data" OFF)
option(ENABLE_DATA_MYSQL "Enable Data MySQL" OFF)
option(ENABLE_DATA_MYSQL "Enable Data MySQL or MariaDB" OFF)
endif()
if(ENABLE_DATA_POSTGRESQL)
@ -166,10 +163,8 @@ option(ENABLE_TESTS
option(POCO_STATIC
"Set to OFF|ON (default is OFF) to control build of POCO as STATIC library" OFF)
if(POCO_STATIC)
message(STATUS "Building static libraries")
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
else()
message(STATUS "Building dynamic libraries")
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
@ -442,12 +437,28 @@ install(
)
message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator")
message(STATUS "Installation target path: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "${PROJECT_NAME} package version: ${PROJECT_VERSION}")
if(BUILD_SHARED_LIBS)
message(STATUS "Building dynamic libraries")
else()
message(STATUS "Building static libraries")
endif()
message(STATUS "[cmake] Installation target path: ${CMAKE_INSTALL_PREFIX}")
if(CMAKE_TOOLCHAIN_FILE)
message(STATUS "[cmake] Use toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()
message(STATUS "[cmake] Bulid for OS type: ${CMAKE_SYSTEM_NAME}")
message(STATUS "[cmake] Build for OS version: ${CMAKE_SYSTEM_VERSION}")
message(STATUS "[cmake] Build for CPU type: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "[cmake] Build type: ${CMAKE_BUILD_TYPE}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
message(STATUS "[cmake] build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "[cmake] build with cxx flags: ${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${CMAKE_CXX_FLAGS}")
message(STATUS "[cmake] build with c flags: ${CMAKE_C_FLAGS_${BUILD_TYPE}} ${CMAKE_C_FLAGS}")
message(STATUS "[cmake] Build with cxx flags: ${CMAKE_CXX_FLAGS_${BUILD_TYPE}} ${CMAKE_CXX_FLAGS}")
message(STATUS "[cmake] Build with c flags: ${CMAKE_C_FLAGS_${BUILD_TYPE}} ${CMAKE_C_FLAGS}")
if(NOT DISABLE_CPP14)
message(STATUS "Build with C++14 support")
elseif(NOT DISABLE_CPP11)
message(STATUS "Build with C++11 support")
endif()
foreach(component ${Poco_COMPONENTS})
message(STATUS "Building: ${component}")

View File

@ -121,21 +121,24 @@ endif()
if (CYGWIN)
target_compile_definitions(Foundation PUBLIC POCO_NO_FPENVIRONMENT POCO_NO_WSTRING _XOPEN_SOURCE=500 __BSD_VISIBLE)
else (CYGWIN)
else()
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)
else()
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)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
target_compile_definitions(Foundation PUBLIC POCO_HAVE_FD_POLL)
target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt)
endif (QNX)
else()
target_compile_definitions(Foundation PUBLIC _XOPEN_SOURCE=500 POCO_HAVE_FD_EPOLL)
target_link_libraries(Foundation PUBLIC pthread ${CMAKE_DL_LIBS} rt)
endif()
endif (APPLE)
endif(UNIX AND NOT ANDROID )
endif (CYGWIN)