RemoveEmptyCommands.cmake 765 B

12345678910111213141516171819202122
  1. enable_language(CXX)
  2. # reduce number of configuration types
  3. set(CMAKE_CONFIGURATION_TYPES "Debug" "Release")
  4. set(main_file "${CMAKE_BINARY_DIR}/main.cpp")
  5. file(WRITE "${main_file}" "test")
  6. add_executable(exe "${main_file}")
  7. # add one command for all and one for debug only
  8. add_custom_command(TARGET exe
  9. COMMAND "cmd_1" "cmd_1_arg"
  10. COMMAND $<$<CONFIG:Debug>:cmd_1_dbg> $<$<CONFIG:Debug>:cmd_1_dbg_arg>)
  11. # add command for debug only
  12. add_custom_command(TARGET exe
  13. COMMAND $<$<CONFIG:Debug>:cmd_2_dbg> $<$<CONFIG:Debug>:cmd_2_dbg_arg>)
  14. # add separate commands for configurations
  15. add_custom_command(TARGET exe
  16. COMMAND $<$<CONFIG:Debug>:cmd_3_dbg> $<$<CONFIG:Debug>:cmd_3_dbg_arg>
  17. COMMAND $<$<CONFIG:Release>:cmd_3_rel> $<$<CONFIG:Release>:cmd_3_rel_arg>)