Commit 2b3a0dbe authored by David Cole's avatar David Cole Committed by Kitware Robot

Merge topic 'ninja-mingw-windres'

c8641037 Ninja: path is already declared
6547f369 Ninja: more searching for windres
78588e03 Ninja: there could be null pointers
0c89c10c Ninja: search for windres with prefix
46546809 Ninja: windres is also used for cross-compiling
parents 8a0a918f c8641037
......@@ -474,10 +474,33 @@ void cmGlobalNinjaGenerator
if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
{
UsingMinGW = true;
std::string rc = cmSystemTools::FindProgram("windres");
if(rc.empty())
rc = "windres.exe";;
mf->AddDefinition("CMAKE_RC_COMPILER", rc.c_str());
if(!mf->GetDefinition("CMAKE_RC_COMPILER"))
{
std::string windres = cmSystemTools::FindProgram("windres");
if(windres.empty())
{
std::string compiler_path;
std::string::size_type prefix = std::string::npos;
if (mf->GetDefinition("CMAKE_C_COMPILER"))
{
compiler_path = mf->GetDefinition("CMAKE_C_COMPILER");
prefix = compiler_path.rfind("gcc");
}
else if (mf->GetDefinition("CMAKE_CXX_COMPILER"))
{
compiler_path = mf->GetDefinition("CMAKE_CXX_COMPILER");
prefix = compiler_path.rfind("++");
prefix--;
}
if (prefix != std::string::npos)
{
windres = compiler_path.substr(0, prefix) + "windres";
windres = cmSystemTools::FindProgram(windres.c_str());
}
}
if(!windres.empty())
mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str());
}
}
}
this->cmGlobalGenerator::EnableLanguage(language, mf, optional);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment