mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
cmLinkLineComputer: Add ComputeLinkLibs overload with backtraces
This commit is contained in:
@@ -70,6 +70,8 @@ public:
|
|||||||
|
|
||||||
std::string GetConfig() const { return this->Config; }
|
std::string GetConfig() const { return this->Config; }
|
||||||
|
|
||||||
|
const cmGeneratorTarget* GetTarget() { return this->Target; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddItem(std::string const& item, const cmGeneratorTarget* tgt);
|
void AddItem(std::string const& item, const cmGeneratorTarget* tgt);
|
||||||
void AddSharedDepItem(std::string const& item, cmGeneratorTarget const* tgt);
|
void AddSharedDepItem(std::string const& item, cmGeneratorTarget const* tgt);
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "cmComputeLinkInformation.h"
|
#include "cmComputeLinkInformation.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
|
#include "cmLinkItem.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmOutputConverter.h"
|
#include "cmOutputConverter.h"
|
||||||
#include "cmStateDirectory.h"
|
#include "cmStateDirectory.h"
|
||||||
@@ -58,6 +59,15 @@ std::string cmLinkLineComputer::ConvertToLinkReference(
|
|||||||
std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
|
std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
|
||||||
{
|
{
|
||||||
std::string linkLibs;
|
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;
|
using ItemVector = cmComputeLinkInformation::ItemVector;
|
||||||
ItemVector const& items = cli.GetItems();
|
ItemVector const& items = cli.GetItems();
|
||||||
for (auto const& item : items) {
|
for (auto const& item : items) {
|
||||||
@@ -66,17 +76,32 @@ std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BT<std::string> linkLib;
|
||||||
if (item.IsPath) {
|
if (item.IsPath) {
|
||||||
linkLibs += cli.GetLibLinkFileFlag();
|
linkLib.Value += cli.GetLibLinkFileFlag();
|
||||||
linkLibs +=
|
linkLib.Value +=
|
||||||
this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
|
this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
|
||||||
} else {
|
} else {
|
||||||
linkLibs += item.Value;
|
linkLib.Value += item.Value;
|
||||||
}
|
}
|
||||||
linkLibs += " ";
|
linkLib.Value += " ";
|
||||||
}
|
|
||||||
|
|
||||||
return linkLibs;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
linkLibraries.emplace_back(linkLib);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
|
std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
|
||||||
|
@@ -53,6 +53,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
|
std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
|
||||||
|
void ComputeLinkLibs(cmComputeLinkInformation& cli,
|
||||||
|
std::vector<BT<std::string>>& linkLibraries);
|
||||||
std::string ComputeRPath(cmComputeLinkInformation& cli);
|
std::string ComputeRPath(cmComputeLinkInformation& cli);
|
||||||
|
|
||||||
std::string ConvertToOutputFormat(std::string const& input);
|
std::string ConvertToOutputFormat(std::string const& input);
|
||||||
|
Reference in New Issue
Block a user