mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Propagate backtraces from LINK_LIBRARIES through to link line items
Since commit d4d0dd0f6a (cmLinkLineComputer: Add ComputeLinkLibs
overload with backtraces, 2019-09-13, v3.16.0-rc1~87^2~4), backtraces
have been collected by `ComputeLinkLibs` by looking back through the
link implementation libraries for one matching the text of the link line
item. This is slow in projects with long link lines.
Instead, teach `cmComputeLinkDepends` and `cmComputeLinkInformation` to
carry backtrace information explicitly along with the text of each item.
Fixes: #20322
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "cmComputeLinkInformation.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmLinkItem.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmOutputConverter.h"
|
||||
#include "cmStateDirectory.h"
|
||||
@@ -79,27 +78,14 @@ void cmLinkLineComputer::ComputeLinkLibs(
|
||||
BT<std::string> linkLib;
|
||||
if (item.IsPath) {
|
||||
linkLib.Value += cli.GetLibLinkFileFlag();
|
||||
linkLib.Value +=
|
||||
this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
|
||||
linkLib.Value += this->ConvertToOutputFormat(
|
||||
this->ConvertToLinkReference(item.Value.Value));
|
||||
linkLib.Backtrace = item.Value.Backtrace;
|
||||
} else {
|
||||
linkLib.Value += item.Value;
|
||||
linkLib = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
linkLibraries.emplace_back(linkLib);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user