mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-25 10:18:34 -06:00
@@ -16,11 +16,11 @@ function(create_targets prefix)
|
||||
|
||||
get_write_file_command(cmd ${prefix}PostBuild.txt)
|
||||
add_executable(${prefix}PostBuild ${CMAKE_SOURCE_DIR}/main.c)
|
||||
add_custom_command(TARGET ${prefix}PostBuild COMMAND ${cmd} BYPRODUCTS ${prefix}PostBuild.txt)
|
||||
add_custom_command(TARGET ${prefix}PostBuild POST_BUILD COMMAND ${cmd} BYPRODUCTS ${prefix}PostBuild.txt)
|
||||
|
||||
get_write_file_command(cmd ${prefix}TargetPostBuild.txt)
|
||||
add_custom_target(${prefix}TargetPostBuild)
|
||||
add_custom_command(TARGET ${prefix}TargetPostBuild COMMAND ${cmd} BYPRODUCTS ${prefix}TargetPostBuild.txt)
|
||||
add_custom_command(TARGET ${prefix}TargetPostBuild POST_BUILD COMMAND ${cmd} BYPRODUCTS ${prefix}TargetPostBuild.txt)
|
||||
|
||||
file(APPEND "${CMAKE_BINARY_DIR}/target_files_custom.cmake"
|
||||
"set(TARGET_DEPENDS_${prefix}Command [==[${CMAKE_CURRENT_BINARY_DIR}/${prefix}Command.txt]==])
|
||||
|
||||
@@ -9,14 +9,17 @@ add_executable(exe "${main_file}")
|
||||
|
||||
# add one command for all and one for debug only
|
||||
add_custom_command(TARGET exe
|
||||
POST_BUILD
|
||||
COMMAND "cmd_1" "cmd_1_arg"
|
||||
COMMAND $<$<CONFIG:Debug>:cmd_1_dbg> $<$<CONFIG:Debug>:cmd_1_dbg_arg>)
|
||||
|
||||
# add command for debug only
|
||||
add_custom_command(TARGET exe
|
||||
POST_BUILD
|
||||
COMMAND $<$<CONFIG:Debug>:cmd_2_dbg> $<$<CONFIG:Debug>:cmd_2_dbg_arg>)
|
||||
|
||||
# add separate commands for configurations
|
||||
add_custom_command(TARGET exe
|
||||
POST_BUILD
|
||||
COMMAND $<$<CONFIG:Debug>:cmd_3_dbg> $<$<CONFIG:Debug>:cmd_3_dbg_arg>
|
||||
COMMAND $<$<CONFIG:Release>:cmd_3_rel> $<$<CONFIG:Release>:cmd_3_rel_arg>)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
add_library(TargetImported UNKNOWN IMPORTED)
|
||||
add_custom_command(TARGET TargetImported COMMAND ${CMAKE_COMMAND} -E echo tada)
|
||||
add_custom_command(TARGET TargetImported POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo tada)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
add_subdirectory(TargetNotInDir)
|
||||
add_custom_command(TARGET TargetNotInDir COMMAND ${CMAKE_COMMAND} -E echo tada)
|
||||
add_custom_command(TARGET TargetNotInDir POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo tada)
|
||||
|
||||
Reference in New Issue
Block a user