summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-11-25 22:47:44 +0100
committerStephen Kelly <steveire@gmail.com>2015-03-09 20:48:57 +0100
commit5c559f11137dcb14113a3c5df99ff896c65c7596 (patch)
tree63e0fcb01e959715cd0eca161ec799f5e1048fb2 /Source/cmGeneratorExpressionEvaluator.cxx
parente387ce7d681f9bd6c90c41f34b7500dfeb3b32ba (diff)
downloadcmake-5c559f11137dcb14113a3c5df99ff896c65c7596.tar.gz
Genex: Enable use of COMPILE_LANGUAGE for compile options.
Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 63a46f2743..6a9f251b21 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -827,6 +827,40 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
"components of the file(GENERATE) command.");
return std::string();
}
+
+ std::vector<std::string> enabledLanguages;
+ cmGlobalGenerator* gg
+ = context->Makefile->GetLocalGenerator()->GetGlobalGenerator();
+ gg->GetEnabledLanguages(enabledLanguages);
+ if (!parameters.empty() &&
+ std::find(enabledLanguages.begin(), enabledLanguages.end(),
+ parameters.front()) == enabledLanguages.end())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<COMPILE_LANGUAGE:...> Unknown language.");
+ return std::string();
+ }
+
+ std::string genName = gg->GetName();
+ if (genName.find("Visual Studio") != std::string::npos)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<COMPILE_LANGUAGE:...> may not be used with Visual Studio "
+ "generators.");
+ return std::string();
+ }
+ else
+ {
+ if(genName.find("Makefiles") == std::string::npos &&
+ genName.find("Ninja") == std::string::npos &&
+ genName.find("Watcom WMake") == std::string::npos &&
+ genName.find("Xcode") == std::string::npos)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<COMPILE_LANGUAGE:...> not supported for this generator.");
+ return std::string();
+ }
+ }
if (parameters.empty())
{
return context->Language;