Files
poco/cmake/DefinePlatformSpecific.cmake
Matej Kenda 7a23a039f9 Reorganise external libs to separate subdirectory (#4996)
* chore(PCRE): properly detect library type on newer macOS

* chore(ZLIB): move source files to own zlib directory and update CMake files.

* chore(PCRE): move source files to own pcre2 directory and update CMake files.

* chore(UTF8PROC): move source files to own utf8proc directory and update CMake files.

* chore(ZLIB): remove header files

* chore(PDJSON): move source files to own pdjson directory and update CMake files.

* chore(SQLite3): move source files to own sqlite3 directory and update CMake files.

* chore(UNBUNDLED): Correct includes.

* chore(expat): move source files to own expat directory and update CMake files.

* chore(wepoll): move source files to own wepoll directory and update CMake files.

* chore(7zip): move source files to own 7zip directory and update CMake files.

* chore(CMake): fix compile and link flags for dependent static libraries

* chore(CMake): set PCRE2_STATIC when building PCRE2.

* chore(SQLite3): Set SQLITE_THREADSAFE for unbundled build, add warnings.

* chore(CMake): Modifications to build and link properly static target libraries (using OBJECT library type and link using BUILD_LOCAL_INTERFACE)

* chore(CMake): fix order of includes in main CMakeLists.txt.

* chore(CI): Build mysql tests with cmake.

* chore(CI): Build mongodb, redis, sqlite no parser tests with cmake.

* chore(CI): Build odbc tests with cmake.

* chore(CI): Build more ations with cmake, other fixes.

* chore(CI): Fixes for macOS

* chore(CMake): extract hpdf and png files to own directories in dependencies

* fix(CMake): include dependencies after all module dependencies are resolved.

* fix(CMake): Improve dependency handling of dependencies to compile them only when necessary.

* fix(CMake): PDF: move t4.h to proper directory, modify include.

* fix(CMake): Fixes to link properly on all platforms.

* fix(CMAKE): Wrong ENABLE for SQLITE

* enh(PDF): Remove dependencies on hpdf headers from Poco::PDF interface and make usage of hpdf only internal.

* enh(CI): Convert more jobs to use cmake.

* enh(CI): Convert macOS sanitizer jobs to use cmake.

* enh(mkrelease): Copy dependencies when creating release package.

* eng(CMake): Add missing POCO_SO option to enable/disable small object optimization.

* enh(CI): Run linux sanitizer with cmake, various fixes and improvements.

* fix(CMake): bundled build: ZLIB::ZLIB is already linked with Foundation, no need to link again to Poco::Zip

* fix(CI): vptr undefined sanitizer causes foundation tests to fail when linking, disable it

* chore(tests): Minor code improvements.

* fix(AsyncNotificationCenter): fix a data race with member _listsEmpty by making it atomic.

* eng(CI): Add a few more time sensitive tests to cppignore.lnx

* chore(Thread): Code updates.

* eng(CI): Add a few more time sensitive tests to cppignore.lnx

* fix(AsyncNotificationCenter): must join threads to avoid data race in dtor.

* chore(CI): Pass TSAN_OPTIONS to jobs where necessary

* chore(CI): run rests without sudo, compile with parallelism

* chore(CI): Use POCO_MINIMAL_BUILD to simplify CMake configure lines.

* chore(CI): Add 32-bit Windows VS build

* chore(CMake): Printout cmake generator platform.

* chore(CMake): linux-gcc-make-armv7l -> linux-gcc-cmake-armv7l

* chore(ci): windows-2025-msvc-cmake-32bit -> windows-2025-msvc-cmake-Win32

* chore(CI): Convert all remaining jobs to CMake.

* chore(make): Prevent building with make.

* chore(CodeQL): exclude all external code from CodeQL checks.

* chore(macOS): Set min support version to 13.3 to properly support C++20 standard.
2025-09-11 17:11:29 +02:00

90 lines
3.4 KiB
CMake

# 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
# using CMake variable CMAKE_MSVC_RUNTIME_LIBRARY.
#
# 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(BUILD_SHARED_LIBS)
add_compile_definitions(POCO_DLL)
else()
add_compile_definitions(POCO_STATIC)
endif()
if(MSVC)
if(POCO_MT)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE)
else(POCO_MT)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
endif(POCO_MT)
message(STATUS "MSVC runtime library: ${CMAKE_MSVC_RUNTIME_LIBRARY}")
if(POCO_SANITIZE_ASAN)
message(WARNING "Use POCO_SANITIZEFLAGS instead of POCO_SANITIZE_ASAN")
add_compile_options("/fsanitize=address")
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)
if (DEFINED POCO_SANITIZEFLAGS AND NOT "${POCO_SANITIZEFLAGS}" STREQUAL "")
message(STATUS "Using sanitize flags: ${POCO_SANITIZEFLAGS}")
add_compile_options(${POCO_SANITIZEFLAGS})
add_link_options(${POCO_SANITIZEFLAGS})
endif()
if (ENABLE_COMPILER_WARNINGS)
message(STATUS "Enabling additional compiler warning flags.")
# Additional compiler-specific warning flags
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using clang
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using Visual Studio C++
add_compile_options(/W4)
endif()
endif()
# Add a d postfix to the debug libraries
if(BUILD_SHARED_LIBS)
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 "" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
else(BUILD_SHARED_LIBS)
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}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
endif()
# OS Detection
include(CheckTypeSize)
find_package(Cygwin)