diff options
author | Brad King <brad.king@kitware.com> | 2014-03-04 18:25:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-05 18:07:41 (GMT) |
commit | 489b1c23b9a880da0012427b60cce7b6f5ddaa27 (patch) | |
tree | b2688130d3a3af8bd6bd9e3d230510508069afde /Source/cmMakefileTargetGenerator.cxx | |
parent | 745caae6dddc9ab5c38a669adf3906f6e3484c80 (diff) | |
download | CMake-489b1c23b9a880da0012427b60cce7b6f5ddaa27.zip CMake-489b1c23b9a880da0012427b60cce7b6f5ddaa27.tar.gz CMake-489b1c23b9a880da0012427b60cce7b6f5ddaa27.tar.bz2 |
Windows: Use response files to specify link libraries for GNU tools
Work around the command-line-length limit by using an @linklibs.rsp
response file to pass the flags for link libraries. This allows
very long lists of libraries to be used in addition to the existing
support for passing object files via response file.
Suggested-by: Peter Keuschnigg <peter.keuschnigg@pmu.ac.at>
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0f2b6e3..facbcc6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1834,14 +1834,40 @@ cmMakefileTargetGenerator void cmMakefileTargetGenerator ::CreateLinkLibs(std::string& linkLibs, bool relink, + bool useResponseFile, std::vector<std::string>& makefile_depends) { std::string frameworkPath; std::string linkPath; this->LocalGenerator ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *this->GeneratorTarget, relink, false); + *this->GeneratorTarget, relink, + useResponseFile); linkLibs = frameworkPath + linkPath + linkLibs; + + if(useResponseFile) + { + // Lookup the response file reference flag. + std::string responseFlagVar = "CMAKE_"; + responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); + responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; + const char* responseFlag = + this->Makefile->GetDefinition(responseFlagVar.c_str()); + if(!responseFlag) + { + responseFlag = "@"; + } + + // Create this response file. + std::string link_rsp = + this->CreateResponseFile("linklibs.rsp", linkLibs, makefile_depends); + + // Reference the response file. + linkLibs = responseFlag; + linkLibs += this->Convert(link_rsp.c_str(), + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + } } //---------------------------------------------------------------------------- |