From 0c6468178a76b6a2a11791b010ab01c97855affa Mon Sep 17 00:00:00 2001 From: Justin Goshi Date: Wed, 11 Sep 2019 10:31:05 -0700 Subject: cmComputeLinkInformation: Add GetDirectoriesWithBacktraces --- Source/cmComputeLinkInformation.cxx | 22 ++++++++++++++++++++++ Source/cmComputeLinkInformation.h | 1 + 2 files changed, 23 insertions(+) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index ed0bb85..6ee6455 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -431,6 +431,28 @@ std::vector const& cmComputeLinkInformation::GetDirectories() return this->OrderLinkerSearchPath->GetOrderedDirectories(); } +std::vector> +cmComputeLinkInformation::GetDirectoriesWithBacktraces() +{ + std::vector> directoriesWithBacktraces; + + std::vector> targetLinkDirectores = + this->Target->GetLinkDirectories(this->Config, this->LinkLanguage); + + const std::vector& orderedDirectories = this->GetDirectories(); + for (const std::string& dir : orderedDirectories) { + auto result = + std::find(targetLinkDirectores.begin(), targetLinkDirectores.end(), dir); + if (result != targetLinkDirectores.end()) { + directoriesWithBacktraces.emplace_back(std::move(*result)); + } else { + directoriesWithBacktraces.emplace_back(dir); + } + } + + return directoriesWithBacktraces; +} + std::string cmComputeLinkInformation::GetRPathLinkString() const { // If there is no separate linker runtime search flag (-rpath-link) diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index ee36a71..71af43f 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -48,6 +48,7 @@ public: void AppendValues(std::string& result, std::vector>& values); ItemVector const& GetItems() const; std::vector const& GetDirectories() const; + std::vector> GetDirectoriesWithBacktraces(); std::vector const& GetDepends() const; std::vector const& GetFrameworkPaths() const; std::string GetLinkLanguage() const { return this->LinkLanguage; } -- cgit v0.12