1
0
Эх сурвалжийг харах

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.
Kyle Edwards 5 жил өмнө
parent
commit
1844be451e

+ 1 - 0
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 "

+ 1 - 0
Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake

@@ -0,0 +1 @@
+# Intentionally empty

+ 4 - 0
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)