diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-11-25 21:47:44 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-03-09 19:48:57 (GMT) |
commit | 5c559f11137dcb14113a3c5df99ff896c65c7596 (patch) | |
tree | 63e0fcb01e959715cd0eca161ec799f5e1048fb2 /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba (diff) | |
download | CMake-5c559f11137dcb14113a3c5df99ff896c65c7596.zip CMake-5c559f11137dcb14113a3c5df99ff896c65c7596.tar.gz CMake-5c559f11137dcb14113a3c5df99ff896c65c7596.tar.bz2 |
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.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 63a46f2..6a9f251 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; |