summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-07 18:01:58 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-07 18:02:44 (GMT)
commit378c2a0e860f32e0435844d7d6af79a4fdc2b455 (patch)
tree3ab57abbcb7c76aeeafe4ff28316284ceea122af /Source/cmGlobalNinjaGenerator.cxx
parent957c2aac7fb4833b333cf3362cb8c6918a8e8a82 (diff)
downloadCMake-378c2a0e860f32e0435844d7d6af79a4fdc2b455.zip
CMake-378c2a0e860f32e0435844d7d6af79a4fdc2b455.tar.gz
CMake-378c2a0e860f32e0435844d7d6af79a4fdc2b455.tar.bz2
Ninja: Refactor detection of MinGW tools on Windows
Check for CMAKE_COMPILER_IS_MINGW only after enabling a language when it might actually be set. Previously this worked by accident because the check for working compiler or a second language enabled would cause the code path to be taken. Store UsingMinGW as an instance member of cmGlobalNinjaGenerator so that it is reset on each reconfigure. Otherwise cmake-gui cannot switch between build trees for MinGW or non-MinGW tools.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx24
1 files changed, 11 insertions, 13 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 9a017e5..9894aa8 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -96,7 +96,7 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string &path)
{
std::string result = path;
#ifdef _WIN32
- if(UsingMinGW)
+ if (this->IsMinGW())
cmSystemTools::ReplaceString(result, "\\", "/");
else
cmSystemTools::ReplaceString(result, "/", "\\");
@@ -484,6 +484,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
, CompileCommandsStream(0)
, Rules()
, AllDependencies()
+ , UsingMinGW(false)
, ComputingUnknownDependencies(false)
, PolicyCMP0058(cmPolicies::WARN)
{
@@ -544,23 +545,16 @@ void cmGlobalNinjaGenerator::Generate()
this->CloseBuildFileStream();
}
-// Implemented in all cmGlobaleGenerator sub-classes.
-// Used in:
-// Source/cmMakefile.cxx:
void cmGlobalNinjaGenerator
::EnableLanguage(std::vector<std::string>const& langs,
- cmMakefile* makefile,
+ cmMakefile* mf,
bool optional)
{
- if (makefile->IsOn("CMAKE_COMPILER_IS_MINGW"))
- {
- UsingMinGW = true;
- }
if (std::find(langs.begin(), langs.end(), "Fortran") != langs.end())
{
cmSystemTools::Error("The Ninja generator does not support Fortran yet.");
}
- this->cmGlobalGenerator::EnableLanguage(langs, makefile, optional);
+ this->cmGlobalGenerator::EnableLanguage(langs, mf, optional);
for(std::vector<std::string>::const_iterator l = langs.begin();
l != langs.end(); ++l)
{
@@ -568,12 +562,16 @@ void cmGlobalNinjaGenerator
{
continue;
}
- this->ResolveLanguageCompiler(*l, makefile, optional);
+ this->ResolveLanguageCompiler(*l, mf, optional);
}
+#ifdef _WIN32
+ if (mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
+ {
+ this->UsingMinGW = true;
+ }
+#endif
}
-bool cmGlobalNinjaGenerator::UsingMinGW = false;
-
// Implemented by:
// cmGlobalUnixMakefileGenerator3
// cmGlobalGhsMultiGenerator