diff options
author | Brad King <brad.king@kitware.com> | 2008-02-27 22:10:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-02-27 22:10:45 (GMT) |
commit | dfe2ea6406d3ab22f1a4193906611fb67fd3ab6e (patch) | |
tree | e00166515d5fe978ef5fe0dd15852790145951e0 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | 4c137bad6b663ff342064c293a49fecf03498207 (diff) | |
download | CMake-dfe2ea6406d3ab22f1a4193906611fb67fd3ab6e.zip CMake-dfe2ea6406d3ab22f1a4193906611fb67fd3ab6e.tar.gz CMake-dfe2ea6406d3ab22f1a4193906611fb67fd3ab6e.tar.bz2 |
ENH: Handle large object file lists on some platforms
- Use a response file when enabled by
CMAKE_<LANG>_USE_RESPONSE_FILE_FOR_OBJECTS
- Enable for C and CXX with cl (MSVC)
- Enable for Fortran with ifort (Intel Fortran)
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index dd4c9eb..1c7f108 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -567,6 +567,18 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Determine whether a link script will be used. bool useLinkScript = this->GlobalGenerator->GetUseLinkScript(); + // Select whether to use a response file for objects. + bool useResponseFile = false; + { + std::string responseVar = "CMAKE_"; + responseVar += linkLanguage; + responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; + if(this->Makefile->IsOn(responseVar.c_str())) + { + useResponseFile = true; + } + } + // For static libraries there might be archiving rules. std::vector<std::string> archiveCreateCommands; std::vector<std::string> archiveAppendCommands; @@ -605,6 +617,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Archiving rules are always run with a link script. useLinkScript = true; + // Archiving rules never use a response file. + useResponseFile = false; + // Limit the length of individual object lists to less than the // 32K command line length limit on Windows. We could make this a // platform file variable but this should work everywhere. @@ -631,7 +646,18 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string variableNameExternal; this->WriteObjectsVariable(variableName, variableNameExternal); std::string buildObjs; - if(useLinkScript) + if(useResponseFile) + { + std::string objects; + this->WriteObjectsString(objects); + std::string objects_rsp = + this->CreateResponseFile("objects.rsp", objects, depends); + buildObjs = "@"; + buildObjs += this->Convert(objects_rsp.c_str(), + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + } + else if(useLinkScript) { if(!useArchiveRules) { |