summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-01-20 22:24:05 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-26 18:30:37 (GMT)
commit50e1c1056ea82690474dc186d7a4103b33547fa6 (patch)
treee8d00c862b81444d0439d10debedde6e94bc4b56
parent8643ca75c705568bc9bb084a5182baef04865d2d (diff)
downloadCMake-50e1c1056ea82690474dc186d7a4103b33547fa6.zip
CMake-50e1c1056ea82690474dc186d7a4103b33547fa6.tar.gz
CMake-50e1c1056ea82690474dc186d7a4103b33547fa6.tar.bz2
Makefile: For static libraries remove only the "real" lib before creating
When creating a static library with the archive tool, only the `.a` needs to be removed to start a fresh archive. Any other files (e.g. symbolic links we may later add) are not managed by the archive tool and therefore do not need to be cleaned.
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 33f2c35..ff8b604 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -598,6 +598,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> libCleanFiles;
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
+
+ std::vector<std::string> commands1;
+ // Add a command to remove any existing files for this library.
+ // for static libs only
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
+ this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
+ this->GeneratorTarget, "target");
+ this->LocalGenerator->CreateCDCommand(
+ commands1, this->Makefile->GetCurrentBinaryDirectory(),
+ this->LocalGenerator->GetBinaryDirectory());
+ commands.insert(commands.end(), commands1.begin(), commands1.end());
+ commands1.clear();
+ }
+
if (targetName != targetNameReal) {
libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
@@ -634,19 +648,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
#endif
- std::vector<std::string> commands1;
- // Add a command to remove any existing files for this library.
- // for static libs only
- if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
- this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
- this->GeneratorTarget, "target");
- this->LocalGenerator->CreateCDCommand(
- commands1, this->Makefile->GetCurrentBinaryDirectory(),
- this->LocalGenerator->GetBinaryDirectory());
- commands.insert(commands.end(), commands1.begin(), commands1.end());
- commands1.clear();
- }
-
// Add the pre-build and pre-link rules building but not when relinking.
if (!relink) {
this->LocalGenerator->AppendCustomCommands(