summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-10-15 14:21:21 (GMT)
committerBrad King <brad.king@kitware.com>2008-10-15 14:21:21 (GMT)
commit9c29a72fbc6f52f9e2ac558811b74490355329d3 (patch)
tree07732ab82e1b033eb0f14970bb41a4defbce8ee5 /Source/cmMakefileTargetGenerator.cxx
parent07454a39f1fc57b147d1311b952702f3ff2b595b (diff)
downloadCMake-9c29a72fbc6f52f9e2ac558811b74490355329d3.zip
CMake-9c29a72fbc6f52f9e2ac558811b74490355329d3.tar.gz
CMake-9c29a72fbc6f52f9e2ac558811b74490355329d3.tar.bz2
ENH: Support object lists longer than 128K on MSVC
We use response files to list object files for the MSVC linker. The linker complains if any response file is greater than 128K, so we split the object file lists into multiple response files.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx37
1 files changed, 29 insertions, 8 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index b25ae60..41e3612 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1634,14 +1634,35 @@ cmMakefileTargetGenerator
this->WriteObjectsVariable(variableName, variableNameExternal);
if(useResponseFile)
{
- std::string objects;
- this->WriteObjectsString(objects);
- std::string objects_rsp =
- this->CreateResponseFile("objects.rsp", objects, makefile_depends);
- buildObjs = "@";
- buildObjs += this->Convert(objects_rsp.c_str(),
- cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
+ // MSVC response files cannot exceed 128K.
+ std::string::size_type const responseFileLimit = 131000;
+
+ // Construct the individual object list strings.
+ std::vector<std::string> object_strings;
+ this->WriteObjectsStrings(object_strings, responseFileLimit);
+
+ // Write a response file for each string.
+ const char* sep = "";
+ for(unsigned int i = 0; i < object_strings.size(); ++i)
+ {
+ // Number the response files.
+ char rsp[32];
+ sprintf(rsp, "objects%u.rsp", i+1);
+
+ // Create this response file.
+ std::string objects_rsp =
+ this->CreateResponseFile(rsp, object_strings[i], makefile_depends);
+
+ // Separate from previous response file references.
+ buildObjs += sep;
+ sep = " ";
+
+ // Reference the response file.
+ buildObjs += "@";
+ buildObjs += this->Convert(objects_rsp.c_str(),
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL);
+ }
}
else if(useLinkScript)
{