From 82cfeb5940e06fc02a90046285d8a90b67669477 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Wed, 3 Mar 2021 10:11:52 +0100 Subject: [PATCH] cmake more robust --- cmake/corsikaConfig.cmake.in | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/cmake/corsikaConfig.cmake.in b/cmake/corsikaConfig.cmake.in index 5aadf213c..81a499c04 100644 --- a/cmake/corsikaConfig.cmake.in +++ b/cmake/corsikaConfig.cmake.in @@ -8,6 +8,24 @@ set (CORSIKA8_VERSION @c8_version@) option (WITH_HISTORY "Flag to switch on/off HISTORY" ON) +#+++++++++++++++++++++++++++++ +# Build types settings +# +# setup coverage build type +set (CMAKE_CXX_FLAGS_COVERAGE "-g --coverage") +set (CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage") +set (CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage") +# set a flag to inform code that we are in debug mode +set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") +set (ALLOWED_BUILD_TYPES Debug Release MinSizeRel RelWithDebInfo Coverage) +set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${ALLOWED_BUILD_TYPES}) +set (DEFAULT_BUILD_TYPE "Release") +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set (CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE + STRING "Choose the type of build." FORCE) +endif (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + + #++++++++++++++++++++++++++++ # General config and flags # @@ -49,7 +67,11 @@ check_required_components (corsika) # add further definitions / options # if (WITH_HISTORY) - target_compile_definitions (CORSIKA8::CORSIKA8 INTERFACE "WITH_HISTORY") + set_property ( + TARGET CORSIKA8::CORSIKA8 + APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "WITH_HISTORY" + ) endif (WITH_HISTORY) -- GitLab