Ninja: more searching for windres
search for windres with and without prefix, and also when only CXX compiler is set.
This commit is contained in:
parent
78588e0343
commit
6547f369e4
|
@ -474,15 +474,30 @@ void cmGlobalNinjaGenerator
|
||||||
if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
|
if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
|
||||||
{
|
{
|
||||||
UsingMinGW = true;
|
UsingMinGW = true;
|
||||||
if(!mf->GetDefinition("CMAKE_RC_COMPILER")
|
if(!mf->GetDefinition("CMAKE_RC_COMPILER"))
|
||||||
&& mf->GetDefinition("CMAKE_C_COMPILER"))
|
|
||||||
{
|
{
|
||||||
std::string windres = "windres";
|
std::string windres = cmSystemTools::FindProgram("windres");
|
||||||
std::string gcc = mf->GetDefinition("CMAKE_C_COMPILER");
|
if(windres.empty())
|
||||||
std::string::size_type prefix = gcc.rfind("gcc");
|
{
|
||||||
if (prefix != std::string::npos)
|
std::string path;
|
||||||
windres.insert(0, gcc.substr(0, prefix));
|
std::string::size_type prefix = std::string::npos;
|
||||||
windres = cmSystemTools::FindProgram(windres.c_str());
|
if (mf->GetDefinition("CMAKE_C_COMPILER"))
|
||||||
|
{
|
||||||
|
path = mf->GetDefinition("CMAKE_C_COMPILER");
|
||||||
|
prefix = path.rfind("gcc");
|
||||||
|
}
|
||||||
|
else if (mf->GetDefinition("CMAKE_CXX_COMPILER"))
|
||||||
|
{
|
||||||
|
path = mf->GetDefinition("CMAKE_CXX_COMPILER");
|
||||||
|
prefix = path.rfind("++");
|
||||||
|
prefix--;
|
||||||
|
}
|
||||||
|
if (prefix != std::string::npos)
|
||||||
|
{
|
||||||
|
windres = path.substr(0, prefix) + "windres";
|
||||||
|
windres = cmSystemTools::FindProgram(windres.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!windres.empty())
|
if(!windres.empty())
|
||||||
mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str());
|
mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue