Browse Source

Ninja: Prevent compilers to be silently modified

Unlike with Unix Makefiles generator modifying compiler paths was not
protected with Ninja generator.  It was possible to modify them in the
cache without the expected effect on the generated solution.  Also
activate corresponding tests with Ninja.
Sylvain Joubert 11 years ago
parent
commit
6120fca8e2
2 changed files with 10 additions and 1 deletions
  1. 9 0
      Source/cmGlobalNinjaGenerator.cxx
  2. 1 1
      Tests/RunCMake/CMakeLists.txt

+ 9 - 0
Source/cmGlobalNinjaGenerator.cxx

@@ -540,6 +540,15 @@ void cmGlobalNinjaGenerator
     cmSystemTools::Error("The Ninja generator does not support Fortran yet.");
     }
   this->cmGlobalGenerator::EnableLanguage(langs, makefile, optional);
+  for(std::vector<std::string>::const_iterator l = langs.begin();
+      l != langs.end(); ++l)
+    {
+    if(*l == "NONE")
+      {
+      continue;
+      }
+    this->ResolveLanguageCompiler(*l, makefile, optional);
+    }
 }
 
 bool cmGlobalNinjaGenerator::UsingMinGW = false;

+ 1 - 1
Tests/RunCMake/CMakeLists.txt

@@ -50,7 +50,7 @@ add_RunCMake_test(CMP0051)
 add_RunCMake_test(CMP0053)
 add_RunCMake_test(CMP0054)
 add_RunCMake_test(CTest)
-if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
+if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
   add_RunCMake_test(CompilerChange)
 endif()
 add_RunCMake_test(CompilerNotFound)