diff options
author | Brad King <brad.king@kitware.com> | 2019-05-07 15:12:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-07 15:12:38 (GMT) |
commit | 1628e4677a25fc253e94eaae33f6e9aed13ca98a (patch) | |
tree | 37e4c0f6229264deb7ead5a65949c2c146693e3d /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 37bf503db268c41d5a337265300357c76bda34ea (diff) | |
parent | f83e4359f20034f750729e5a4123de8f54265dd9 (diff) | |
download | CMake-1628e4677a25fc253e94eaae33f6e9aed13ca98a.zip CMake-1628e4677a25fc253e94eaae33f6e9aed13ca98a.tar.gz CMake-1628e4677a25fc253e94eaae33f6e9aed13ca98a.tar.bz2 |
Merge topic 'touch-after-ranlib'
f83e4359f2 Apple: Preserve high resolution mtime for static libraries
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3283
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index af47fa7..ebb7c15 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -535,6 +535,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: |