From d805ea11d2d3bf130906f3ec61ccf6cf0bed475d Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Wed, 23 Sep 2020 18:44:47 +0200 Subject: [PATCH] CMake: add option DD4HEP_BUILD_DEBUG if ON or OFF enable or disable the DD4HEP_DEBUG definition if not set, enable if BuildType is Debug --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd3564e5e..1866ed41c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,12 @@ OPTION(DD4HEP_DEBUG_CMAKE "Print debugging information for DD4hep CMAKE" OFF) SET(DD4HEP_USE_EXISTING_DD4HEP "" CACHE STRING "Build some parts of DD4hep against an existing installation") SET(DD4HEP_HIGH_MEM_POOL_DEPTH "${DD4HEP_HIGH_MEM_POOL_DEPTH}" CACHE STRING "Number of build slots for high memory compile units (DDParsers), Ninja only") +SET(DD4HEP_BUILD_DEBUG "" CACHE STRING "Enable some DEBUG features in DD4hep. Set to 'ON' or 'OFF' to override default handling") + +IF(DD4HEP_BUILD_DEBUG AND NOT DD4HEP_BUILD_DEBUG MATCHES "ON|OFF") + MESSAGE(FATAL_ERROR "Invalid value for DD4HEP_BUILD_DEBUG, ${DD4HEP_BUILD_DEBUG}, use '', 'ON', 'OFF'") +ENDIF() + # create the job pool set_property(GLOBAL PROPERTY JOB_POOLS HIGH_MEM_POOL=${DD4HEP_HIGH_MEM_POOL_DEPTH}) ##################### @@ -197,6 +203,9 @@ ELSE() dd4hep_print("|> Building ${DDPackage}") add_subdirectory(${DDPackage}) ENDFOREACH() + IF(DD4HEP_BUILD_DEBUG MATCHES "ON" OR (CMAKE_BUILD_TYPE MATCHES "DEBUG|Debug" AND NOT DD4HEP_BUILD_DEBUG MATCHES "OFF")) + target_compile_definitions(DDCore PUBLIC DD4HEP_DEBUG) + ENDIF() message(STATUS "BUILD Packages: ${DD4HEP_BUILD_PACKAGES}") FOREACH(DDPackage IN LISTS DD4HEP_BUILD_PACKAGES) -- GitLab