summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionNode.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-01 13:59:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-09-01 13:59:08 (GMT)
commit8f73ff0c3707e5b3f27f54f2b94e03ccb193d698 (patch)
tree78acec97adb3be0f9433847a138eddd0e19860d7 /Source/cmGeneratorExpressionNode.cxx
parent3001e8b5d9caac4e941870509545c9b3c808dd70 (diff)
parentf14b390198222f5d7eca9e5109fabcb0188da762 (diff)
downloadCMake-8f73ff0c3707e5b3f27f54f2b94e03ccb193d698.zip
CMake-8f73ff0c3707e5b3f27f54f2b94e03ccb193d698.tar.gz
CMake-8f73ff0c3707e5b3f27f54f2b94e03ccb193d698.tar.bz2
Merge topic 'target_genex_dependency'
f14b390198 GenEx: Remove unneeded dependencies from target info queries Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Raul Tambre <raul@tambre.ee> Merge-request: !5127
Diffstat (limited to 'Source/cmGeneratorExpressionNode.cxx')
-rw-r--r--Source/cmGeneratorExpressionNode.cxx70
1 files changed, 68 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 83e9aac..1cc1d18 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1902,6 +1902,70 @@ class ArtifactSonameTag;
class ArtifactBundleDirTag;
class ArtifactBundleContentDirTag;
+template <typename ArtifactT, typename ComponentT>
+struct TargetFilesystemArtifactDependency
+{
+ static void AddDependency(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context)
+ {
+ context->DependTargets.insert(target);
+ context->AllTargets.insert(target);
+ }
+};
+
+struct TargetFilesystemArtifactDependencyCMP0112
+{
+ static void AddDependency(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context)
+ {
+ context->AllTargets.insert(target);
+ cmLocalGenerator* lg = context->LG;
+ switch (target->GetPolicyStatusCMP0112()) {
+ case cmPolicies::WARN:
+ if (lg->GetMakefile()->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0112")) {
+ std::string err =
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0112),
+ "\nDependency being added to target:\n \"",
+ target->GetName(), "\"\n");
+ lg->GetCMakeInstance()->IssueMessage(MessageType ::AUTHOR_WARNING,
+ err, context->Backtrace);
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ context->DependTargets.insert(target);
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ break;
+ }
+ }
+};
+
+template <typename ArtifactT>
+struct TargetFilesystemArtifactDependency<ArtifactT, ArtifactNameTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+template <typename ArtifactT>
+struct TargetFilesystemArtifactDependency<ArtifactT, ArtifactDirTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+template <>
+struct TargetFilesystemArtifactDependency<ArtifactBundleDirTag,
+ ArtifactPathTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+template <>
+struct TargetFilesystemArtifactDependency<ArtifactBundleContentDirTag,
+ ArtifactPathTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+
template <typename ArtifactT>
struct TargetFilesystemArtifactResultCreator
{
@@ -2154,8 +2218,10 @@ struct TargetFilesystemArtifact : public TargetArtifactBase
if (!target) {
return std::string();
}
- context->DependTargets.insert(target);
- context->AllTargets.insert(target);
+ // Not a dependent target if we are querying for ArtifactDirTag,
+ // ArtifactNameTag, ArtifactBundleDirTag, and ArtifactBundleContentDirTag
+ TargetFilesystemArtifactDependency<ArtifactT, ComponentT>::AddDependency(
+ target, context);
std::string result =
TargetFilesystemArtifactResultCreator<ArtifactT>::Create(target, context,