diff options
author | Ben Leadbetter <ben.leadbetter@native-instruments.com> | 2022-04-14 13:44:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-04-22 13:23:46 (GMT) |
commit | 997af2e1a6b8f2d644dfe1734653398633cafe52 (patch) | |
tree | ec45b931a94389ccfe9b4cecde7ac202c4f06d07 /Source/cmGeneratorExpressionNode.cxx | |
parent | 627b2eba6c2e8790ba7091f5123e114e9363726d (diff) | |
download | CMake-997af2e1a6b8f2d644dfe1734653398633cafe52.zip CMake-997af2e1a6b8f2d644dfe1734653398633cafe52.tar.gz CMake-997af2e1a6b8f2d644dfe1734653398633cafe52.tar.bz2 |
Genex: Add TARGET_BUNDLE_DIR_NAME
Evaluate to the name of the bundle directory for a given bundle target.
Fixes: #23409
Diffstat (limited to 'Source/cmGeneratorExpressionNode.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index a9bc435..26ffd4b 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2098,6 +2098,7 @@ class ArtifactPathTag; class ArtifactPdbTag; class ArtifactSonameTag; class ArtifactBundleDirTag; +class ArtifactBundleDirNameTag; class ArtifactBundleContentDirTag; template <typename ArtifactT, typename ComponentT> @@ -2158,6 +2159,12 @@ struct TargetFilesystemArtifactDependency<ArtifactBundleDirTag, { }; template <> +struct TargetFilesystemArtifactDependency<ArtifactBundleDirNameTag, + ArtifactPathTag> + : TargetFilesystemArtifactDependencyCMP0112 +{ +}; +template <> struct TargetFilesystemArtifactDependency<ArtifactBundleContentDirTag, ArtifactPathTag> : TargetFilesystemArtifactDependencyCMP0112 @@ -2285,6 +2292,31 @@ struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag> }; template <> +struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirNameTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (target->IsImported()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_BUNDLE_DIR_NAME not allowed for IMPORTED targets."); + return std::string(); + } + if (!target->IsBundleOnApple()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_BUNDLE_DIR_NAME is allowed only for Bundle targets."); + return std::string(); + } + + return target->GetAppBundleDirectory(context->Config, + cmGeneratorTarget::BundleDirLevel); + } +}; + +template <> struct TargetFilesystemArtifactResultCreator<ArtifactBundleContentDirTag> { static std::string Create(cmGeneratorTarget* target, @@ -2417,7 +2449,8 @@ struct TargetFilesystemArtifact : public TargetArtifactBase return std::string(); } // Not a dependent target if we are querying for ArtifactDirTag, - // ArtifactNameTag, ArtifactBundleDirTag, and ArtifactBundleContentDirTag + // ArtifactNameTag, ArtifactBundleDirTag, ArtifactBundleDirNameTag, + // and ArtifactBundleContentDirTag TargetFilesystemArtifactDependency<ArtifactT, ComponentT>::AddDependency( target, context); @@ -2458,6 +2491,10 @@ static const TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> static const TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag> targetBundleDirNode; +static const TargetFilesystemArtifact<ArtifactBundleDirNameTag, + ArtifactNameTag> + targetBundleDirNameNode; + static const TargetFilesystemArtifact<ArtifactBundleContentDirTag, ArtifactPathTag> targetBundleContentDirNode; @@ -2783,6 +2820,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_SONAME_FILE_DIR", &targetSoNameNodeGroup.FileDir }, { "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir }, { "TARGET_BUNDLE_DIR", &targetBundleDirNode }, + { "TARGET_BUNDLE_DIR_NAME", &targetBundleDirNameNode }, { "TARGET_BUNDLE_CONTENT_DIR", &targetBundleContentDirNode }, { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, |