mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
Ninja Multi-Config: Correctly generate POST_BUILD custom targets
Fixes: #22096
This commit is contained in:
@@ -173,7 +173,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
|
|||||||
std::string ccConfig;
|
std::string ccConfig;
|
||||||
if (genTarget->Target->IsPerConfig() &&
|
if (genTarget->Target->IsPerConfig() &&
|
||||||
genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
|
genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
|
||||||
ccConfig = fileConfig;
|
ccConfig = config;
|
||||||
}
|
}
|
||||||
if (config == fileConfig ||
|
if (config == fileConfig ||
|
||||||
gg->GetPerConfigUtilityTargets().count(genTarget->GetName())) {
|
gg->GetPerConfigUtilityTargets().count(genTarget->GetName())) {
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
^\[1/2\] target_post_build
|
||||||
|
target main build
|
||||||
|
\[2/2\] Running utility command for target_post_build
|
||||||
|
target post build$
|
@@ -189,3 +189,11 @@ add_custom_target(target_no_cross_byproduct
|
|||||||
COMMAND echo $<CONFIG> target_no_cross_byproduct.txt
|
COMMAND echo $<CONFIG> target_no_cross_byproduct.txt
|
||||||
WORKING_DIRECTORY $<CONFIG>
|
WORKING_DIRECTORY $<CONFIG>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_custom_target(target_post_build
|
||||||
|
COMMENT target_post_build
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "target main build"
|
||||||
|
)
|
||||||
|
add_custom_command(TARGET target_post_build POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "target post build"
|
||||||
|
)
|
||||||
|
@@ -364,6 +364,8 @@ run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug build-Debug.n
|
|||||||
run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
|
run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
|
||||||
run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug-in-release-graph build-Release.ninja target_no_cross_byproduct:Debug)
|
run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug-in-release-graph build-Release.ninja target_no_cross_byproduct:Debug)
|
||||||
run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
|
run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
|
||||||
|
# target_post_build
|
||||||
|
run_ninja(CustomCommandOutputGenex target_post_build-debug build-Debug.ninja target_post_build)
|
||||||
unset(RunCMake_TEST_NO_CLEAN)
|
unset(RunCMake_TEST_NO_CLEAN)
|
||||||
|
|
||||||
unset(RunCMake_TEST_BINARY_DIR)
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
|
Reference in New Issue
Block a user