summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-07-18 10:58:48 (GMT)
committerBrad King <brad.king@kitware.com>2013-07-24 14:40:00 (GMT)
commit4f6bd7022bf670f9516c7b5e67c254d639425ab4 (patch)
tree710881681b38d86aa8801dabcce2895206c6f969 /Source/cmGeneratorExpressionEvaluator.cxx
parentf82c751d7b3ee3907d780060985a36bdddcabad3 (diff)
downloadCMake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.zip
CMake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.tar.gz
CMake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.tar.bz2
Remove the LINK_LANGUAGE generator expression.
It accepted an optional argument to test for equality, but no way to get the linker language of a particular target. TARGET_PROPERTY provides this flexibility and STREQUAL provides the necessary API for equality test. Extend the CompileDefinitions test to cover accessing the property of another target.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx78
1 files changed, 13 insertions, 65 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 381ef7c..c1f53b4 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -573,69 +573,6 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
}
} configurationTestNode;
-//----------------------------------------------------------------------------
-static const struct LinkLanguageNode : public cmGeneratorExpressionNode
-{
- LinkLanguageNode() {}
-
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
-
- std::string Evaluate(const std::vector<std::string> &parameters,
- cmGeneratorExpressionContext *context,
- const GeneratorExpressionContent *content,
- cmGeneratorExpressionDAGChecker *dagChecker) const
- {
- if (dagChecker && dagChecker->EvaluatingLinkLibraries())
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> expression can not be used while evaluating "
- "link libraries");
- return std::string();
- }
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> expression requires one or two parameters");
- return std::string();
- }
- cmTarget* target = context->HeadTarget;
- if (!target)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> may only be used with targets. It may not "
- "be used with add_custom_command.");
- return std::string();
- }
-
- const char *lang = target->GetLinkerLanguage(context->Config);
- if (parameters.size() == 0)
- {
- return lang ? lang : "";
- }
- else
- {
- cmsys::RegularExpression langValidator;
- langValidator.compile("^[A-Za-z0-9_]*$");
- if (!langValidator.find(parameters.begin()->c_str()))
- {
- reportError(context, content->GetOriginalExpression(),
- "Expression syntax not recognized.");
- return std::string();
- }
- if (!lang)
- {
- return parameters.front().empty() ? "1" : "0";
- }
-
- if (strcmp(parameters.begin()->c_str(), lang) == 0)
- {
- return "1";
- }
- return "0";
- }
- }
-} linkLanguageNode;
-
static const struct JoinNode : public cmGeneratorExpressionNode
{
JoinNode() {}
@@ -835,6 +772,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
assert(target);
+ if (propertyName == "LINKER_LANGUAGE")
+ {
+ if (dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "LINKER_LANGUAGE target property can not be used while evaluating "
+ "link libraries");
+ return std::string();
+ }
+ const char *lang = target->GetLinkerLanguage(context->Config);
+ return lang ? lang : "";
+ }
+
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
target->GetName(),
propertyName,
@@ -1380,8 +1330,6 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &configurationNode;
else if (identifier == "CONFIG")
return &configurationTestNode;
- else if (identifier == "LINK_LANGUAGE")
- return &linkLanguageNode;
else if (identifier == "TARGET_FILE")
return &targetFileNode;
else if (identifier == "TARGET_LINKER_FILE")