summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index d95006e..037ef31 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -469,8 +469,15 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content,
- cmGeneratorExpressionDAGChecker *) const
+ 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(),
@@ -483,6 +490,7 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode
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);
@@ -1146,7 +1154,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content,
- cmGeneratorExpressionDAGChecker *) const
+ cmGeneratorExpressionDAGChecker *dagChecker) const
{
// Lookup the referenced target.
std::string name = *parameters.begin();
@@ -1171,6 +1179,13 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"Target \"" + name + "\" is not an executable or library.");
return std::string();
}
+ if (dagChecker && dagChecker->EvaluatingLinkLibraries(name.c_str()))
+ {
+ ::reportError(context, content->GetOriginalExpression(),
+ "Expressions which require the linker language may not "
+ "be used while evaluating link libraries");
+ return std::string();
+ }
context->DependTargets.insert(target);
context->AllTargets.insert(target);