summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-05-06 13:45:21 (GMT)
committerBrad King <brad.king@kitware.com>2019-05-06 13:45:21 (GMT)
commit6ced0b97d5fbcaf94f88a5f3062beeb0ad75f186 (patch)
treeaebb1b02cedf31f10b223ae49067eb4ed9c0636b
parent6399e2246ffd1b28d6748730abfd893b6642609b (diff)
parentf83e4359f20034f750729e5a4123de8f54265dd9 (diff)
downloadCMake-6ced0b97d5fbcaf94f88a5f3062beeb0ad75f186.zip
CMake-6ced0b97d5fbcaf94f88a5f3062beeb0ad75f186.tar.gz
CMake-6ced0b97d5fbcaf94f88a5f3062beeb0ad75f186.tar.bz2
Merge branch 'touch-after-ranlib' into release-3.14
Merge-request: !3283
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index cbc0103..becc424 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -537,6 +537,20 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
}
+#ifdef __APPLE__
+ // On macOS ranlib truncates the fractional part of the static archive
+ // file modification time. If the archive and at least one contained
+ // object file were created within the same second this will make look
+ // the archive older than the object file. On subsequent ninja runs this
+ // leads to re-achiving and updating dependent targets.
+ // As a work-around we touch the archive after ranlib (see #19222).
+ {
+ std::string cmakeCommand =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
+ linkCmds.push_back(cmakeCommand + " -E touch $TARGET_FILE");
+ }
+#endif
return linkCmds;
}
case cmStateEnums::SHARED_LIBRARY: