diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2017-03-27 18:54:22 (GMT) |
---|---|---|
committer | Gregor Jasny <gjasny@googlemail.com> | 2017-03-30 20:24:54 (GMT) |
commit | d02709d7f76624d9ec5e178d79cf3658d551f197 (patch) | |
tree | 373a020c19f19042402a05e67aa5f45ef20ba8c3 /Source/cmGeneratorExpressionNode.cxx | |
parent | 013ffe76e7d67fdb05fe29c82421b0a000feb468 (diff) | |
download | CMake-d02709d7f76624d9ec5e178d79cf3658d551f197.zip CMake-d02709d7f76624d9ec5e178d79cf3658d551f197.tar.gz CMake-d02709d7f76624d9ec5e178d79cf3658d551f197.tar.bz2 |
Genex: Add `TARGET_BUNDLE_[CONTENT_]_DIR` generator expressions
Closes #16733
Diffstat (limited to 'Source/cmGeneratorExpressionNode.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 66202df..4443499 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1504,6 +1504,8 @@ class ArtifactNameTag; class ArtifactPathTag; class ArtifactPdbTag; class ArtifactSonameTag; +class ArtifactBundleDirTag; +class ArtifactBundleContentDirTag; template <typename ArtifactT> struct TargetFilesystemArtifactResultCreator @@ -1600,6 +1602,56 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag> }; template <> +struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (target->IsImported()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_BUNDLE_DIR not allowed for IMPORTED targets."); + return std::string(); + } + if (!target->IsBundleOnApple()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_BUNDLE_DIR is allowed only for Bundle targets."); + return std::string(); + } + + std::string outpath = target->GetDirectory(context->Config) + '/'; + return target->BuildBundleDirectory(outpath, context->Config, + cmGeneratorTarget::BundleDirLevel); + } +}; + +template <> +struct TargetFilesystemArtifactResultCreator<ArtifactBundleContentDirTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (target->IsImported()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets."); + return std::string(); + } + if (!target->IsBundleOnApple()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets."); + return std::string(); + } + + std::string outpath = target->GetDirectory(context->Config) + '/'; + return target->BuildBundleDirectory(outpath, context->Config, + cmGeneratorTarget::ContentLevel); + } +}; + +template <> struct TargetFilesystemArtifactResultCreator<ArtifactNameTag> { static std::string Create(cmGeneratorTarget* target, @@ -1716,6 +1768,13 @@ static const TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> static const TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> targetPdbNodeGroup; +static const TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag> + targetBundleDirNode; + +static const TargetFilesystemArtifact<ArtifactBundleContentDirTag, + ArtifactPathTag> + targetBundleContentDirNode; + static const struct ShellPathNode : public cmGeneratorExpressionNode { ShellPathNode() {} @@ -1772,6 +1831,8 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; + nodeMap["TARGET_BUNDLE_DIR"] = &targetBundleDirNode; + nodeMap["TARGET_BUNDLE_CONTENT_DIR"] = &targetBundleContentDirNode; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; |