summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-26 15:25:38 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-04-26 15:25:46 (GMT)
commit71087120b9ee7e3f3372cc87f08e2da608c1fd11 (patch)
tree19e23c25545d1496a4dbcc29f5fa762d47fe36b3
parentdd44a98bfe2c5dc79cb3058cd222835023b80dfd (diff)
parentf8e2a74712c01f205c794102dd0151feace7a5df (diff)
downloadCMake-71087120b9ee7e3f3372cc87f08e2da608c1fd11.zip
CMake-71087120b9ee7e3f3372cc87f08e2da608c1fd11.tar.gz
CMake-71087120b9ee7e3f3372cc87f08e2da608c1fd11.tar.bz2
Merge topic 'ninja-multi-custom-target-post-build' into release-3.20
f8e2a74712 Ninja Multi-Config: Correctly generate POST_BUILD custom targets Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6040
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt4
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake8
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake2
4 files changed, 15 insertions, 1 deletions
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index a18ca20..92c5b52 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -173,7 +173,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
std::string ccConfig;
if (genTarget->Target->IsPerConfig() &&
genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
- ccConfig = fileConfig;
+ ccConfig = config;
}
if (config == fileConfig ||
gg->GetPerConfigUtilityTargets().count(genTarget->GetName())) {
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt
new file mode 100644
index 0000000..6bf0a49
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt
@@ -0,0 +1,4 @@
+^\[1/2\] target_post_build
+target main build
+\[2/2\] Running utility command for target_post_build
+target post build$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
index e49cc32..bb68a50 100644
--- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
@@ -189,3 +189,11 @@ add_custom_target(target_no_cross_byproduct
COMMAND echo $<CONFIG> target_no_cross_byproduct.txt
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"
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 23b4aea..aa42739 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -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 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)
+# target_post_build
+run_ninja(CustomCommandOutputGenex target_post_build-debug build-Debug.ninja target_post_build)
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_BINARY_DIR)