summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionNode.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-13 14:16:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-03-13 14:16:25 (GMT)
commit7b81b1c72c5885ac5ec8097ff8f15677e55d8f94 (patch)
treef747308db2dff6a14ed527b47621b3789a628913 /Source/cmGeneratorExpressionNode.cxx
parent40ad7cabc69149391d95c39bb578def164c80441 (diff)
parentb53766b2058160853a29c2bbf8dbfef7345552a4 (diff)
downloadCMake-7b81b1c72c5885ac5ec8097ff8f15677e55d8f94.zip
CMake-7b81b1c72c5885ac5ec8097ff8f15677e55d8f94.tar.gz
CMake-7b81b1c72c5885ac5ec8097ff8f15677e55d8f94.tar.bz2
Merge topic 'cuda_compiler_generator_expressions'
b53766b205 CUDA: Support compiler id and version generator expressions b544e34af6 All VersionNode use the same capitalization pattern Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3085
Diffstat (limited to 'Source/cmGeneratorExpressionNode.cxx')
-rw-r--r--Source/cmGeneratorExpressionNode.cxx50
1 files changed, 48 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 50fd16e..50413c8 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -692,6 +692,28 @@ static const struct CXXCompilerIdNode : public CompilerIdNode
}
} cxxCompilerIdNode;
+static const struct CUDACompilerIdNode : public CompilerIdNode
+{
+ CUDACompilerIdNode() {} // NOLINT(modernize-use-equals-default)
+
+ std::string Evaluate(
+ const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* dagChecker) const override
+ {
+ if (!context->HeadTarget) {
+ reportError(
+ context, content->GetOriginalExpression(),
+ "$<CUDA_COMPILER_ID> may only be used with binary targets. It may "
+ "not be used with add_custom_command or add_custom_target.");
+ return std::string();
+ }
+ return this->EvaluateWithLanguage(parameters, context, content, dagChecker,
+ "CUDA");
+ }
+} cudaCompilerIdNode;
+
static const struct FortranCompilerIdNode : public CompilerIdNode
{
FortranCompilerIdNode() {} // NOLINT(modernize-use-equals-default)
@@ -773,9 +795,9 @@ static const struct CCompilerVersionNode : public CompilerVersionNode
}
} cCompilerVersionNode;
-static const struct CxxCompilerVersionNode : public CompilerVersionNode
+static const struct CXXCompilerVersionNode : public CompilerVersionNode
{
- CxxCompilerVersionNode() {} // NOLINT(modernize-use-equals-default)
+ CXXCompilerVersionNode() {} // NOLINT(modernize-use-equals-default)
std::string Evaluate(
const std::vector<std::string>& parameters,
@@ -795,6 +817,28 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
}
} cxxCompilerVersionNode;
+static const struct CUDACompilerVersionNode : public CompilerVersionNode
+{
+ CUDACompilerVersionNode() {} // NOLINT(modernize-use-equals-default)
+
+ std::string Evaluate(
+ const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* dagChecker) const override
+ {
+ if (!context->HeadTarget) {
+ reportError(
+ context, content->GetOriginalExpression(),
+ "$<CUDA_COMPILER_VERSION> may only be used with binary targets. It "
+ "may not be used with add_custom_command or add_custom_target.");
+ return std::string();
+ }
+ return this->EvaluateWithLanguage(parameters, context, content, dagChecker,
+ "CUDA");
+ }
+} cudaCompilerVersionNode;
+
static const struct FortranCompilerVersionNode : public CompilerVersionNode
{
FortranCompilerVersionNode() {} // NOLINT(modernize-use-equals-default)
@@ -2082,6 +2126,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
{ "NOT", &notNode },
{ "C_COMPILER_ID", &cCompilerIdNode },
{ "CXX_COMPILER_ID", &cxxCompilerIdNode },
+ { "CUDA_COMPILER_ID", &cudaCompilerIdNode },
{ "Fortran_COMPILER_ID", &fortranCompilerIdNode },
{ "VERSION_GREATER", &versionGreaterNode },
{ "VERSION_GREATER_EQUAL", &versionGreaterEqNode },
@@ -2090,6 +2135,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
{ "VERSION_EQUAL", &versionEqualNode },
{ "C_COMPILER_VERSION", &cCompilerVersionNode },
{ "CXX_COMPILER_VERSION", &cxxCompilerVersionNode },
+ { "CUDA_COMPILER_VERSION", &cudaCompilerVersionNode },
{ "Fortran_COMPILER_VERSION", &fortranCompilerVersionNode },
{ "PLATFORM_ID", &platformIdNode },
{ "COMPILE_FEATURES", &compileFeaturesNode },