Ninja: search for windres with prefix

This commit is contained in:
Peter Kümmel 2012-07-15 16:03:22 +02:00
parent 46546809f5
commit 0c89c10cfc
1 changed files with 11 additions and 3 deletions

View File

@ -474,9 +474,17 @@ void cmGlobalNinjaGenerator
if(mf->IsOn("CMAKE_COMPILER_IS_MINGW")) if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
{ {
UsingMinGW = true; UsingMinGW = true;
std::string rc = cmSystemTools::FindProgram("windres"); if(!mf->GetDefinition("CMAKE_RC_COMPILER"))
if(!rc.empty()) {
mf->AddDefinition("CMAKE_RC_COMPILER", rc.c_str()); 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); this->cmGlobalGenerator::EnableLanguage(language, mf, optional);