ENH: Build large archives incrementally

Creation of archive libraries with the unix 'ar' tool should be done
incrementally when the number of object files is large.  This avoids
problems with the command line getting too many arguments.
This commit is contained in:
Brad King
2008-08-04 11:37:19 -04:00
parent 0c20967a6b
commit aaa88d33a9
4 changed files with 19 additions and 21 deletions
@@ -612,12 +612,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
// For static libraries there might be archiving rules.
bool haveStaticLibraryRule = false;
std::vector<std::string> archiveCreateCommands;
std::vector<std::string> archiveAppendCommands;
std::vector<std::string> archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
if(this->Target->GetType() == cmTarget::STATIC_LIBRARY)
{
haveStaticLibraryRule =
this->Makefile->GetDefinition(linkRuleVar)? true:false;
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
arCreateVar += "_ARCHIVE_CREATE";
@@ -643,6 +646,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Decide whether to use archiving rules.
bool useArchiveRules =
!haveStaticLibraryRule &&
!archiveCreateCommands.empty() && !archiveAppendCommands.empty();
if(useArchiveRules)
{