diff options
author | Peter Kümmel <syntheticpp@gmx.net> | 2012-07-15 17:38:51 (GMT) |
---|---|---|
committer | Peter Kümmel <syntheticpp@gmx.net> | 2012-07-15 17:59:37 (GMT) |
commit | 6547f369e4c3b71071da8534fcbe141320389c82 (patch) | |
tree | 047fc8caf42177e6947825eee0a0d753a26d049e /Source/cmGlobalNinjaGenerator.cxx | |
parent | 78588e03435103fca17372278cbecf29c867eec1 (diff) | |
download | CMake-6547f369e4c3b71071da8534fcbe141320389c82.zip CMake-6547f369e4c3b71071da8534fcbe141320389c82.tar.gz CMake-6547f369e4c3b71071da8534fcbe141320389c82.tar.bz2 |
Ninja: more searching for windres
search for windres with and without prefix,
and also when only CXX compiler is set.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ca3a270..abf5c82 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -474,15 +474,30 @@ void cmGlobalNinjaGenerator if(mf->IsOn("CMAKE_COMPILER_IS_MINGW")) { UsingMinGW = true; - if(!mf->GetDefinition("CMAKE_RC_COMPILER") - && mf->GetDefinition("CMAKE_C_COMPILER")) + if(!mf->GetDefinition("CMAKE_RC_COMPILER")) { - std::string windres = "windres"; - std::string gcc = mf->GetDefinition("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()); + std::string windres = cmSystemTools::FindProgram("windres"); + if(windres.empty()) + { + std::string path; + std::string::size_type prefix = std::string::npos; + 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()) mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str()); } |