A use case has arisen in the Hadronics WG to have some blocks of source code suppressed in user release builds (the code should only be compiled for developers). Could the build type (INSTALL_TYPES) be mapped to a preprocessor macro (e.g., "GEANT4_INSTALL_DEVELOPER") to enable this use case by way of #ifdef GEANT4_INSTALL_DEVELOPER /* Code for developer use at runtime ONLY */ #endif The INSTALL_TYPES string cannot just be put into a macro value, because #if only works with integer values.
Just for my own notes, the only tricky part is handling the different build modes in multi-config IDEs. Look at use of COMPILE_DEFINITIONS_<CONFIG> target property: http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:COMPILE_DEFINITIONS_CONFIG
Fix proposed in tag cmake-V09-06-06. The compile definition "GEANT4_DEVELOPER_<CONFIG>" is added to the definitions for each Geant4 target as appropriate for the available build types/configurations. For example, if the build type is "Debug", the the sources will be built with the definition "GEANT4_DEVELOPER_DEBUG". This behaviour is the same for all other build modes, and also works with multiconfiguration tools such as Xcode. The definition should *not* appear in any Geant4 header files.