diff options
author | Peter Kuemmel <syntheticpp@gmx.net> | 2012-06-08 14:31:54 (GMT) |
---|---|---|
committer | Peter Kuemmel <syntheticpp@gmx.net> | 2012-06-08 15:42:11 (GMT) |
commit | 033a687acd828ad6667d154939ffdbc482ab047f (patch) | |
tree | 7e61efbc88da39b57810be42d502baaab0145136 /Source/cmGlobalNinjaGenerator.cxx | |
parent | 1d40729eaa35dd643efdf5e793e6a541e890f33a (diff) | |
download | CMake-033a687acd828ad6667d154939ffdbc482ab047f.zip CMake-033a687acd828ad6667d154939ffdbc482ab047f.tar.gz CMake-033a687acd828ad6667d154939ffdbc482ab047f.tar.bz2 |
Ninja: add wrapper for cl to extract dependencies
cmcldeps wraps cl and adds /showInclude before calling cl.
It parses the output of cl for used headers, drops system
headers and writes them to a GCC like dependency file.
cmcldeps uses ATM ninja code for process handling,
but could be ported later to SystemTools.
TODO: Why needs ninja multiple calls in the BuildDepends test?
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index c4b1cc9..9a2597b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -460,17 +460,28 @@ void cmGlobalNinjaGenerator // check if mingw is used const char* cc = mf->GetDefinition("CMAKE_C_COMPILER"); if(cc && std::string(cc).find("gcc.exe") != std::string::npos) - { + { UsingMinGW = true; std::string rc = cmSystemTools::FindProgram("windres"); if(rc.empty()) rc = "windres.exe";; mf->AddDefinition("CMAKE_RC_COMPILER", rc.c_str()); } + else if (cc && std::string(cc).find("cl.exe") != std::string::npos) + { + const char* cmake = mf->GetDefinition("CMAKE_COMMAND"); + std::string bindir = cmake ? cmake : ""; + cmSystemTools::ReplaceString(bindir, "cmake.exe", ""); + std::vector<std::string> locations; + locations.push_back(bindir); + std::string cldeps = cmSystemTools::FindProgram("cmcldeps", locations); + if(!cldeps.empty()) + mf->AddDefinition("CMAKE_CMCLDEPS_EXECUTABLE", cldeps.c_str()); + } } this->cmGlobalGenerator::EnableLanguage(language, mf, optional); this->ResolveLanguageCompiler(*l, mf, optional); - } + } } bool cmGlobalNinjaGenerator::UsingMinGW = false; |