How to get debug postfix in executable name

I am using cmake 2.8.12.2. I installed CMAKE_DEBUG_POSTFIX, and it is automatically used with the command add_library. But it is not used automatically with the command add_executable. I found that I can set the DEBUG_POSTFIXtarget property to get the debug postfix in the executable name, but this requires the use of an additional command.

add_executable(${PROJECT_NAME} ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

Is the second command an explicit target property, DEBUG_POSTFIXor is there an easier way?

+4
source share
1 answer

Current cmake documentation for set_target_properties claims

<CONFIG>_OUTPUT_NAME, . <CONFIG>_POSTFIX , , ( , , "DEBUG_POSTFIX" ). , CMAKE_<CONFIG>_POSTFIX ( , CMake, ).

, , cmake CMAKE_DEBUG_POSTFIX .

add_executable(myexe ${SOURCE_FILES})
set_target_properties(myexe PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

${CMAKE_DEBUG_POSTFIX} myexe DEBUG.

, ${PROJECT_NAME}. myexe project(myexe). ${PROJECT_NAME} myexe, / CMakeLists.txt.

+9

All Articles