diff options
author | Brad King <brad.king@kitware.com> | 2021-06-11 14:52:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-11 15:11:36 (GMT) |
commit | 68bbec66e094e21bdace9607768895b0d381cc2c (patch) | |
tree | 5195a08baaa479c42c402282089831eeb7330f90 /Source/cmFileAPICodemodel.cxx | |
parent | e3c420a74fc528a8c0fb671f50d51df4e938c712 (diff) | |
download | CMake-68bbec66e094e21bdace9607768895b0d381cc2c.zip CMake-68bbec66e094e21bdace9607768895b0d381cc2c.tar.gz CMake-68bbec66e094e21bdace9607768895b0d381cc2c.tar.bz2 |
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
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r-- | Source/cmFileAPICodemodel.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 9061109..c96eecd 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -27,7 +27,7 @@ #include "cmInstallGenerator.h" #include "cmInstallSubdirectoryGenerator.h" #include "cmInstallTargetGenerator.h" -#include "cmLinkLineComputer.h" +#include "cmLinkLineComputer.h" // IWYU pragma: keep #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" @@ -1444,9 +1444,10 @@ Json::Value Target::DumpLinkCommandFragments() std::vector<BT<std::string>> linkPath; std::vector<BT<std::string>> linkLibs; cmLocalGenerator* lg = this->GT->GetLocalGenerator(); - cmLinkLineComputer linkLineComputer(lg, - lg->GetStateSnapshot().GetDirectory()); - lg->GetTargetFlags(&linkLineComputer, this->Config, linkLibs, + cmGlobalGenerator* gg = this->GT->GetGlobalGenerator(); + std::unique_ptr<cmLinkLineComputer> linkLineComputer = + gg->CreateLinkLineComputer(lg, lg->GetStateSnapshot().GetDirectory()); + lg->GetTargetFlags(linkLineComputer.get(), this->Config, linkLibs, linkLanguageFlags, linkFlags, frameworkPath, linkPath, this->GT); linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags); |