summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Herz <thomas.herz@kuka.com>2015-05-06 22:45:01 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-07 18:07:20 (GMT)
commitb3de0dfe93af769ee7420cd1380395d656b4dac9 (patch)
treef00d6b329039893f39d09775c2d73a8bc5cab3b7
parent378c2a0e860f32e0435844d7d6af79a4fdc2b455 (diff)
downloadCMake-b3de0dfe93af769ee7420cd1380395d656b4dac9.zip
CMake-b3de0dfe93af769ee7420cd1380395d656b4dac9.tar.gz
CMake-b3de0dfe93af769ee7420cd1380395d656b4dac9.tar.bz2
Ninja: Use forward slashes for any GCC on Windows (#15439)
Any GCC compiler on a Windows host needs forward slashes, not just those built for MinGW.
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx12
-rw-r--r--Source/cmGlobalNinjaGenerator.h4
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
3 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 9894aa8..65e80e4 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 (this->IsMinGW())
+ if (this->IsGCCOnWindows())
cmSystemTools::ReplaceString(result, "\\", "/");
else
cmSystemTools::ReplaceString(result, "/", "\\");
@@ -484,7 +484,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
, CompileCommandsStream(0)
, Rules()
, AllDependencies()
- , UsingMinGW(false)
+ , UsingGCCOnWindows(false)
, ComputingUnknownDependencies(false)
, PolicyCMP0058(cmPolicies::WARN)
{
@@ -565,9 +565,13 @@ void cmGlobalNinjaGenerator
this->ResolveLanguageCompiler(*l, mf, optional);
}
#ifdef _WIN32
- if (mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
+ if (mf->IsOn("CMAKE_COMPILER_IS_MINGW") ||
+ strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "GNU") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "GNU") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "GNU") == 0 ||
+ strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "GNU") == 0)
{
- this->UsingMinGW = true;
+ this->UsingGCCOnWindows = true;
}
#endif
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 9b6717a..00dc237 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -155,7 +155,7 @@ public:
const cmNinjaDeps& targets,
const std::string& comment = "");
- bool IsMinGW() const { return this->UsingMinGW; }
+ bool IsGCCOnWindows() const { return UsingGCCOnWindows; }
public:
/// Default constructor.
@@ -360,7 +360,7 @@ private:
/// The set of dependencies to add to the "all" target.
cmNinjaDeps AllDependencies;
- bool UsingMinGW;
+ bool UsingGCCOnWindows;
/// The set of custom commands we have seen.
std::set<cmCustomCommand const*> CustomCommands;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index a3c9be6..128a35b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -175,7 +175,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
// needed by cmcldeps
false,
this->GetConfigName());
- if (this->GetGlobalGenerator()->IsMinGW())
+ if (this->GetGlobalGenerator()->IsGCCOnWindows())
cmSystemTools::ReplaceString(includeFlags, "\\", "/");
this->LocalGenerator->AppendFlags(languageFlags, includeFlags);