diff options
author | Justin Goshi <jgoshi@microsoft.com> | 2019-09-13 17:59:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-18 17:59:36 (GMT) |
commit | d4d0dd0f6a0f2287fd0fbdfad8c7210515af5eaa (patch) | |
tree | b3c2af8770abb718ab81e591a8010e7049b89147 /Source/cmLinkLineComputer.cxx | |
parent | 0ac9dcb807d6e7b1f905bc9685f8ae217dfce38b (diff) | |
download | CMake-d4d0dd0f6a0f2287fd0fbdfad8c7210515af5eaa.zip CMake-d4d0dd0f6a0f2287fd0fbdfad8c7210515af5eaa.tar.gz CMake-d4d0dd0f6a0f2287fd0fbdfad8c7210515af5eaa.tar.bz2 |
cmLinkLineComputer: Add ComputeLinkLibs overload with backtraces
Diffstat (limited to 'Source/cmLinkLineComputer.cxx')
-rw-r--r-- | Source/cmLinkLineComputer.cxx | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index d5225db..dec25ff 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -9,6 +9,7 @@ #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" +#include "cmLinkItem.h" #include "cmListFileCache.h" #include "cmOutputConverter.h" #include "cmStateDirectory.h" @@ -58,6 +59,15 @@ std::string cmLinkLineComputer::ConvertToLinkReference( std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli) { std::string linkLibs; + std::vector<BT<std::string>> linkLibsList; + this->ComputeLinkLibs(cli, linkLibsList); + cli.AppendValues(linkLibs, linkLibsList); + return linkLibs; +} + +void cmLinkLineComputer::ComputeLinkLibs( + cmComputeLinkInformation& cli, std::vector<BT<std::string>>& linkLibraries) +{ using ItemVector = cmComputeLinkInformation::ItemVector; ItemVector const& items = cli.GetItems(); for (auto const& item : items) { @@ -66,17 +76,32 @@ std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli) continue; } + BT<std::string> linkLib; if (item.IsPath) { - linkLibs += cli.GetLibLinkFileFlag(); - linkLibs += + linkLib.Value += cli.GetLibLinkFileFlag(); + linkLib.Value += this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value)); } else { - linkLibs += item.Value; + linkLib.Value += item.Value; + } + linkLib.Value += " "; + + const cmLinkImplementation* linkImpl = + cli.GetTarget()->GetLinkImplementation(cli.GetConfig()); + + for (const cmLinkImplItem& iter : linkImpl->Libraries) { + if (iter.Target != nullptr && + iter.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + std::string libPath = iter.Target->GetLocation(cli.GetConfig()); + if (item.Value == libPath) { + linkLib.Backtrace = iter.Backtrace; + break; + } + } } - linkLibs += " "; - } - return linkLibs; + linkLibraries.emplace_back(linkLib); + } } std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input) |