1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 12:16:40 +08:00

fileapi: Fix codemodel-v2 link command fragment relative paths

Use the same `cmLinkLineComputer` subclass as the generator does.  This
affects the base directory from which relative paths are computed.

Fixes: #22301
This commit is contained in:
Brad King
2021-06-11 10:52:06 -04:00
parent e3c420a74f
commit 68bbec66e0

View File

@@ -27,7 +27,7 @@
#include "cmInstallGenerator.h" #include "cmInstallGenerator.h"
#include "cmInstallSubdirectoryGenerator.h" #include "cmInstallSubdirectoryGenerator.h"
#include "cmInstallTargetGenerator.h" #include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h" #include "cmLinkLineComputer.h" // IWYU pragma: keep
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
@@ -1444,9 +1444,10 @@ Json::Value Target::DumpLinkCommandFragments()
std::vector<BT<std::string>> linkPath; std::vector<BT<std::string>> linkPath;
std::vector<BT<std::string>> linkLibs; std::vector<BT<std::string>> linkLibs;
cmLocalGenerator* lg = this->GT->GetLocalGenerator(); cmLocalGenerator* lg = this->GT->GetLocalGenerator();
cmLinkLineComputer linkLineComputer(lg, cmGlobalGenerator* gg = this->GT->GetGlobalGenerator();
lg->GetStateSnapshot().GetDirectory()); std::unique_ptr<cmLinkLineComputer> linkLineComputer =
lg->GetTargetFlags(&linkLineComputer, this->Config, linkLibs, gg->CreateLinkLineComputer(lg, lg->GetStateSnapshot().GetDirectory());
lg->GetTargetFlags(linkLineComputer.get(), this->Config, linkLibs,
linkLanguageFlags, linkFlags, frameworkPath, linkPath, linkLanguageFlags, linkFlags, frameworkPath, linkPath,
this->GT); this->GT);
linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags); linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags);