diff options
author | Brad King <brad.king@kitware.com> | 2019-10-02 11:57:16 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-10-02 11:57:25 (GMT) |
commit | a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6 (patch) | |
tree | 853e8fa45bcab56c6616319ddf91d09ce205aaee /Source | |
parent | d57c1a5b3116d1df1bd5a7c2d9857e7b96d2a4f4 (diff) | |
parent | 4891f0f9662d6e2b355717aa1f7250f3462229bb (diff) | |
download | CMake-a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6.zip CMake-a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6.tar.gz CMake-a1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6.tar.bz2 |
Merge topic 'ninja-depend-shared-symlinks'
4891f0f966 Ninja: Ensure shared library version symlinks are created for dependents
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3875
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index bd5abd1..38ccaa3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -13,6 +13,7 @@ #include <cm/memory> #include "cmAlgorithms.h" +#include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" // IWYU pragma: keep #include "cmCustomCommandGenerator.h" #include "cmGeneratedFileStream.h" @@ -1049,6 +1050,26 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Gather order-only dependencies. this->GetLocalGenerator()->AppendTargetDepends(gt, linkBuild.OrderOnlyDeps); + // Add order-only dependencies on versioning symlinks of shared libs we link. + if (!this->GeneratorTarget->IsDLLPlatform()) { + if (cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(this->GetConfigName())) { + for (auto const& item : cli->GetItems()) { + if (item.Target && + item.Target->GetType() == cmStateEnums::SHARED_LIBRARY && + !item.Target->IsFrameworkOnApple()) { + std::string const& lib = this->ConvertToNinjaPath( + item.Target->GetFullPath(this->GetConfigName())); + if (std::find(linkBuild.ImplicitDeps.begin(), + linkBuild.ImplicitDeps.end(), + lib) == linkBuild.ImplicitDeps.end()) { + linkBuild.OrderOnlyDeps.emplace_back(lib); + } + } + } + } + } + // Ninja should restat after linking if and only if there are byproducts. vars["RESTAT"] = byproducts.empty() ? "" : "1"; |