diff options
author | Brad King <brad.king@kitware.com> | 2019-01-21 12:56:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-21 12:56:59 (GMT) |
commit | 177b5fb61b6d1fc64c70ea3bf65652ccad690dd5 (patch) | |
tree | 063426f0af4784163ac4a236d6e54503246566f5 /Source | |
parent | 55a2dc3055e8c5f2189c763eb3fd4c9c754d1c05 (diff) | |
parent | a080914274b32ac53f2449602811aebca7cc7d29 (diff) | |
download | CMake-177b5fb61b6d1fc64c70ea3bf65652ccad690dd5.zip CMake-177b5fb61b6d1fc64c70ea3bf65652ccad690dd5.tar.gz CMake-177b5fb61b6d1fc64c70ea3bf65652ccad690dd5.tar.bz2 |
Merge topic 'fortran-compiler-id'
a080914274 Fortran: Add compiler ID/Version generator expressions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2804
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index fe1b055..6a3f73d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -692,6 +692,28 @@ static const struct CXXCompilerIdNode : public CompilerIdNode } } cxxCompilerIdNode; +static const struct FortranCompilerIdNode : public CompilerIdNode +{ + FortranCompilerIdNode() {} + + 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(), + "$<Fortran_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, + "Fortran"); + } +} fortranCompilerIdNode; + struct CompilerVersionNode : public cmGeneratorExpressionNode { CompilerVersionNode() {} @@ -773,6 +795,28 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode } } cxxCompilerVersionNode; +static const struct FortranCompilerVersionNode : public CompilerVersionNode +{ + FortranCompilerVersionNode() {} + + 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(), + "$<Fortran_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, + "Fortran"); + } +} fortranCompilerVersionNode; + struct PlatformIdNode : public cmGeneratorExpressionNode { PlatformIdNode() {} @@ -2024,6 +2068,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["NOT"] = ¬Node; nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; + nodeMap["Fortran_COMPILER_ID"] = &fortranCompilerIdNode; nodeMap["VERSION_GREATER"] = &versionGreaterNode; nodeMap["VERSION_GREATER_EQUAL"] = &versionGreaterEqNode; nodeMap["VERSION_LESS"] = &versionLessNode; @@ -2031,6 +2076,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["VERSION_EQUAL"] = &versionEqualNode; nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; + nodeMap["Fortran_COMPILER_VERSION"] = &fortranCompilerVersionNode; nodeMap["PLATFORM_ID"] = &platformIdNode; nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; nodeMap["CONFIGURATION"] = &configurationNode; |