From 1844be451e2c27129fbdff9aed121c1b6395c1d0 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Thu, 6 Feb 2020 13:48:08 -0500 Subject: Ninja Multi-Config: Fix issue with CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG Fix an issue where CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG is specified and CMAKE_NMC_CROSS_CONFIGS is not, which results in a false error with CMAKE_NMC_DEFAULT_CONFIGS. --- Source/cmGlobalNinjaGenerator.cxx | 1 + Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake | 1 + Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ff1e5d6..c7bc8bf 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2657,6 +2657,7 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( defaultConfigsString = this->DefaultFileConfig; } if (!defaultConfigsString.empty() && + defaultConfigsString != this->DefaultFileConfig && (this->DefaultFileConfig.empty() || this->CrossConfigs.empty())) { std::ostringstream msg; msg << "CMAKE_NMC_DEFAULT_CONFIGS cannot be used without " diff --git a/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake b/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake new file mode 100644 index 0000000..bb7b160 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake @@ -0,0 +1 @@ +# Intentionally empty diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 2344158..4cf9b04 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -154,6 +154,10 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE run_cmake(InvalidDefaultConfigsNoCross) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release") +run_cmake(DefaultBuildFileConfig) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleNoCross-build) run_cmake_configure(SimpleNoCross) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) -- cgit v0.12