summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-08 21:39:31 (GMT)
committerBrad King <brad.king@kitware.com>2021-12-09 16:00:23 (GMT)
commit1e49880472e58dedd4819fcd4c49a3346f60bb0d (patch)
treee14d78ed896c8709b84b8eba9e6607c8bbcaeef6 /Source/cmGeneratorTarget.h
parent642238b3021ccb1923e57563bb61e0abb0111c84 (diff)
downloadCMake-1e49880472e58dedd4819fcd4c49a3346f60bb0d.zip
CMake-1e49880472e58dedd4819fcd4c49a3346f60bb0d.tar.gz
CMake-1e49880472e58dedd4819fcd4c49a3346f60bb0d.tar.bz2
cmGeneratorTarget: Avoid boolean trap in usage requirement lookup
Replace `bool usage_requirements_only` arguments with a proper enumeration to clarify meaning at call sites.
Diffstat (limited to 'Source/cmGeneratorTarget.h')
-rw-r--r--Source/cmGeneratorTarget.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 9906963..eff5253 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -237,14 +237,20 @@ public:
cmOptionalLinkInterface& iface,
const cmGeneratorTarget* head) const;
+ enum class LinkInterfaceFor
+ {
+ Usage, // Interface for usage requirements excludes $<LINK_ONLY>.
+ Link, // Interface for linking includes $<LINK_ONLY>.
+ };
+
cmLinkInterfaceLibraries const* GetLinkInterfaceLibraries(
const std::string& config, const cmGeneratorTarget* headTarget,
- bool usage_requirements_only) const;
+ LinkInterfaceFor interfaceFor) const;
void ComputeLinkInterfaceLibraries(const std::string& config,
cmOptionalLinkInterface& iface,
const cmGeneratorTarget* head,
- bool usage_requirements_only) const;
+ LinkInterfaceFor interfaceFor) const;
/** Get the library name for an imported interface library. */
std::string GetImportedLibName(std::string const& config) const;
@@ -781,7 +787,7 @@ public:
std::string EvaluateInterfaceProperty(
std::string const& prop, cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagCheckerParent,
- bool usage_requirements_only = true) const;
+ LinkInterfaceFor interfaceFor = LinkInterfaceFor::Usage) const;
bool HaveInstallTreeRPATH(const std::string& config) const;
@@ -994,7 +1000,7 @@ private:
cmLinkInterface const* GetImportLinkInterface(const std::string& config,
const cmGeneratorTarget* head,
- bool usage_requirements_only,
+ LinkInterfaceFor interfaceFor,
bool secondPass = false) const;
using KindedSourcesMapType = std::map<std::string, KindedSources>;
@@ -1008,7 +1014,7 @@ private:
mutable std::unordered_map<std::string, bool> MaybeInterfacePropertyExists;
bool MaybeHaveInterfaceProperty(std::string const& prop,
cmGeneratorExpressionContext* context,
- bool usage_requirements_only) const;
+ LinkInterfaceFor interfaceFor) const;
using TargetPropertyEntryVector =
std::vector<std::unique_ptr<TargetPropertyEntry>>;
@@ -1042,7 +1048,7 @@ private:
void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config,
const cmGeneratorTarget* headTarget,
- bool usage_requirements_only,
+ LinkInterfaceFor interfaceFor,
cmLinkInterface& iface) const;
struct LookupLinkItemScope