diff --git a/CMakeLists.txt b/CMakeLists.txt index 730eda6f7..d7df520bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ -cmake_minimum_required(VERSION 2.8.8) +# CMake 3.8 is required, CMake policy compatibility was verified up to 3.17. +cmake_minimum_required(VERSION 3.8...3.17) set(BOOST_MIN_VERSION "1.66.0") project(icinga2) @@ -13,6 +14,10 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() +# Include symbols in executables so that function names can be printed in stack traces, for example in crash dumps. +set(CMAKE_ENABLE_EXPORTS ON) # Added in CMake 3.4 +set(CMAKE_EXECUTABLE_ENABLE_EXPORTS ON) # Added in CMake 3.27 and supersedes the above one. + option(ICINGA2_WITH_MYSQL "Build the MySQL IDO module" ON) option(ICINGA2_WITH_PGSQL "Build the PostgreSQL IDO module" ON) option(ICINGA2_WITH_CHECKER "Build the checker module" ON) @@ -225,7 +230,6 @@ if(WIN32) list(APPEND base_DEPS ws2_32 dbghelp shlwapi msi) endif() -set(CMAKE_MACOSX_RPATH 1) set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_FULL_LIBDIR}/icinga2") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/icinga-installer/CMakeLists.txt b/icinga-installer/CMakeLists.txt index 6ac5e1f04..1cd80b513 100644 --- a/icinga-installer/CMakeLists.txt +++ b/icinga-installer/CMakeLists.txt @@ -19,6 +19,10 @@ set_target_properties( FOLDER Bin OUTPUT_NAME icinga2-installer LINK_FLAGS "/SUBSYSTEM:WINDOWS" + + # Use a statically-linked runtime library as this binary is run during the installation process where the other DLLs + # may not have been installed already and the system-provided version may be too old. + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" ) target_link_libraries(icinga-installer shlwapi)