summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 78208e3..3c97afc 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -474,9 +474,17 @@ void cmGlobalNinjaGenerator
if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
{
UsingMinGW = true;
- std::string rc = cmSystemTools::FindProgram("windres");
- if(!rc.empty())
- mf->AddDefinition("CMAKE_RC_COMPILER", rc.c_str());
+ if(!mf->GetDefinition("CMAKE_RC_COMPILER"))
+ {
+ std::string windres = "windres";
+ std::string gcc = mf->GetRequiredDefinition("CMAKE_C_COMPILER");
+ std::string::size_type prefix = gcc.rfind("gcc");
+ if (prefix != std::string::npos)
+ windres.insert(0, gcc.substr(0, prefix));
+ windres = cmSystemTools::FindProgram(windres.c_str());
+ if(!windres.empty())
+ mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str());
+ }
}
}
this->cmGlobalGenerator::EnableLanguage(language, mf, optional);