0

I'm willing to set different macro for debug mode and release mode like that:

if (current_is_debug) 
    add_compile_definitions(TAPD)
else()
    add_compile_definitions(TAP)
endif()

I think I shall not set CMAKE_BUILD_TYPE in CMakeLists.txt because I'm to set compile mode when building, i.e.

cmake --build . --config Debug
cmake --build . --config Release 

So Is there anyway to set different macro for different compile mode ? Thanks in advance.

Mactarvish
  • 25
  • 3
  • 1
    The generic way for configuration-specific settings is using [generator expressions](https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html). In you case it could be `add_compile_definitions($,TAPD,TAP>`) – Tsyvarev Oct 31 '22 at 08:02
  • @Tsyvarev Nice! That's exactly what I want. – Mactarvish Oct 31 '22 at 09:33

0 Answers0