diff options
author | Brad King <brad.king@kitware.com> | 2011-03-15 18:07:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-03-17 21:56:13 (GMT) |
commit | 9a0b9bc8b756bcb027485d72fb9619c8e10f5a0a (patch) | |
tree | 5afc4348887308de45cfc01ad573ac9f3b221805 /Source/cmMakefileTargetGenerator.cxx | |
parent | 6e8a67f99a34f2166ee838eb68968ae200830cac (diff) | |
download | CMake-9a0b9bc8b756bcb027485d72fb9619c8e10f5a0a.zip CMake-9a0b9bc8b756bcb027485d72fb9619c8e10f5a0a.tar.gz CMake-9a0b9bc8b756bcb027485d72fb9619c8e10f5a0a.tar.bz2 |
Optionally pass include directories with response files
Create platform option CMAKE_<lang>_USE_RESPONSE_FILE_FOR_INCLUDES to
enable use of response files for passing the list of include directories
to compiler command lines.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a6f7777..69320da 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -310,8 +310,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() this->LocalGenerator->AddSharedFlags(flags, lang, shared); // Add include directory flags. - this->LocalGenerator-> - AppendFlags(flags, this->LocalGenerator->GetIncludeFlags(lang)); + this->AddIncludeFlags(flags, lang); // Append old-style preprocessor definition flags. this->LocalGenerator-> @@ -487,6 +486,8 @@ cmMakefileTargetGenerator { this->LocalGenerator->AppendRuleDepend(depends, this->FlagFileNameFull.c_str()); + this->LocalGenerator->AppendRuleDepends(depends, + this->FlagFileDepends[lang]); // generate the depend scanning rule this->WriteObjectDependRules(source, depends); @@ -1725,6 +1726,38 @@ cmMakefileTargetGenerator } //---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, + const char* lang) +{ + std::string responseVar = "CMAKE_"; + responseVar += lang; + responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES"; + bool useResponseFile = this->Makefile->IsOn(responseVar.c_str()); + + std::string includeFlags = + this->LocalGenerator->GetIncludeFlags(lang, useResponseFile); + if(includeFlags.empty()) + { + return; + } + + if(useResponseFile) + { + std::string name = "includes_"; + name += lang; + name += ".rsp"; + std::string arg = "@" + + this->CreateResponseFile(name.c_str(), includeFlags, + this->FlagFileDepends[lang]); + this->LocalGenerator->AppendFlags(flags, arg.c_str()); + } + else + { + this->LocalGenerator->AppendFlags(flags, includeFlags.c_str()); + } +} + +//---------------------------------------------------------------------------- const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() { // Compute the module directory. |