diff options
author | Brad King <brad.king@kitware.com> | 2020-10-26 20:14:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-10-26 20:14:00 (GMT) |
commit | e9109dec360043d700ac9cb206b116e6f934a5ec (patch) | |
tree | 21fec40ce535afc9faeb1615f69f3bdd506b64c2 | |
parent | 7c0de4175b880c8e0c2baf638d1af3be190a0b6d (diff) | |
parent | d13bd6ec3d7232b4b62d3106684f4f57951f3b28 (diff) | |
download | CMake-e9109dec360043d700ac9cb206b116e6f934a5ec.zip CMake-e9109dec360043d700ac9cb206b116e6f934a5ec.tar.gz CMake-e9109dec360043d700ac9cb206b116e6f934a5ec.tar.bz2 |
Merge branch 'ninja-multi-per-config-sources' into release-3.18
Merge-request: !5430
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 4 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/PerConfigSources.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 4 |
3 files changed, 15 insertions, 1 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 04155e0..2c152ce 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1202,7 +1202,9 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, std::string outputPath = this->NinjaOutputPath(alias); std::string buildAlias = this->BuildAlias(outputPath, config); cmNinjaDeps outputs; - this->AppendTargetOutputs(target, outputs, config); + if (config != "all") { + this->AppendTargetOutputs(target, outputs, config); + } // Mark the target's outputs as ambiguous to ensure that no other target // uses the output as an alias. for (std::string const& output : outputs) { diff --git a/Tests/RunCMake/NinjaMultiConfig/PerConfigSources.cmake b/Tests/RunCMake/NinjaMultiConfig/PerConfigSources.cmake new file mode 100644 index 0000000..7483130 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/PerConfigSources.cmake @@ -0,0 +1,8 @@ +enable_language(C) +file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/main_$<CONFIG>.c" CONTENT +[[int main(void) +{ + return 0; +} +]]) +add_executable(exe "${CMAKE_BINARY_DIR}/main_$<CONFIG>.c") diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 0aef2b9..8496d63 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -246,6 +246,10 @@ unset(RunCMake_TEST_BINARY_DIR) run_cmake(CustomCommandDepfile) +set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all") +run_cmake(PerConfigSources) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostfixAndLocation-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_CROSS_CONFIGS=all") run_cmake_configure(PostfixAndLocation) |