summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-22 13:31:36 (GMT)
committerBrad King <brad.king@kitware.com>2022-03-22 15:57:48 (GMT)
commit73337cb383a704664a47fd3fec84c8feaa303995 (patch)
tree99d8447ed9418486e670ccf6b7f69365bda2615c /Source/cmGeneratorTarget.h
parentc173b1009a12981c91bf9094c58b9b68a3806737 (diff)
downloadCMake-73337cb383a704664a47fd3fec84c8feaa303995.zip
CMake-73337cb383a704664a47fd3fec84c8feaa303995.tar.gz
CMake-73337cb383a704664a47fd3fec84c8feaa303995.tar.bz2
LINK_LIBRARIES: Evaluate separately for linking and usage requirements
We evaluate `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` for two purposes: * Constructing the link line. * Collecting usage requirements. We evaluate `INTERFACE_LINK_LIBRARIES` separately for each purpose in order to support the `$<LINK_ONLY:...>` generator expression used to express private link dependencies of a static library. Previously we only evaluated `LINK_LIBRARIES` for linking, and used that result for collecting usage requirements too. Therefore `$<LINK_ONLY:...>` does not work in `LINK_LIBRARIES`. With the introduction of `INTERFACE_LINK_LIBRARIES_DIRECT`, evaluation of `LINK_LIBRARIES` now needs to distinguish these two cases in order to honor link dependencies encountered through `$<LINK_ONLY:...>` without also exposing other usage requirements through private dependencies of a static library. Revise internal infrastructure to distinguish the two cases when evaluating `LINK_LIBRARIES`. Make the information available in code paths for `INTERFACE_LINK_LIBRARIES_DIRECT` and `LINK_ONLY`. Defer actually using the information to later commits. Issue: #22496
Diffstat (limited to 'Source/cmGeneratorTarget.h')
-rw-r--r--Source/cmGeneratorTarget.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 3e30913..96e48a4 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -399,17 +399,18 @@ public:
LinkClosure const* GetLinkClosure(const std::string& config) const;
cmLinkImplementation const* GetLinkImplementation(
- const std::string& config) const;
+ const std::string& config, LinkInterfaceFor implFor) const;
void ComputeLinkImplementationLanguages(
const std::string& config, cmOptionalLinkImplementation& impl) const;
cmLinkImplementationLibraries const* GetLinkImplementationLibraries(
- const std::string& config) const;
+ const std::string& config, LinkInterfaceFor implFor) const;
void ComputeLinkImplementationLibraries(const std::string& config,
cmOptionalLinkImplementation& impl,
- const cmGeneratorTarget* head) const;
+ const cmGeneratorTarget* head,
+ LinkInterfaceFor implFor) const;
struct TargetOrString
{
@@ -984,6 +985,7 @@ private:
const cmGeneratorTarget* head,
bool secondPass) const;
cmLinkImplementation const* GetLinkImplementation(const std::string& config,
+ LinkInterfaceFor implFor,
bool secondPass) const;
enum class LinkItemRole
@@ -1108,9 +1110,16 @@ private:
};
using LinkImplMapType = std::map<std::string, HeadToLinkImplementationMap>;
mutable LinkImplMapType LinkImplMap;
+ mutable LinkImplMapType LinkImplUsageRequirementsOnlyMap;
+
+ HeadToLinkImplementationMap& GetHeadToLinkImplementationMap(
+ std::string const& config) const;
+ HeadToLinkImplementationMap& GetHeadToLinkImplementationUsageRequirementsMap(
+ std::string const& config) const;
cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
- const std::string& config, const cmGeneratorTarget* head) const;
+ const std::string& config, const cmGeneratorTarget* head,
+ LinkInterfaceFor implFor) const;
bool ComputeOutputDir(const std::string& config,
cmStateEnums::ArtifactType artifact,
std::string& out) const;