From 28c61c904a74db5181a8cc1f3a81fad544d7eab7 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 3 Apr 2025 16:43:31 +0200 Subject: [PATCH] Fix CMake doesn't export symbols of executables anymore CMake 3.4 introduced a new policy [^1] which prevents from automatically adding the compiler flags needed for exporting the symbols of the executables and libraries without the `ENABLE_EXPORTS` property. So, by defining this variable, CMake will restore the previous behaviour by automatically adding the `ENABLE_EXPORTS` properties to all targets. [1]: https://cmake.org/cmake/help/latest/policy/CMP0065.html --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b65845972..023131554 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,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. + if(WIN32) set(ICINGA2_MASTER OFF) else()