diff options
author | Brad King <brad.king@kitware.com> | 2018-05-04 13:35:32 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-05-04 13:36:08 (GMT) |
commit | efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8 (patch) | |
tree | 986031b1e10ed3bfeb89aec0ee66d2c37a13f460 | |
parent | c89d2f4a6ae3e6cb0f87493cac3f5f723bb4f62e (diff) | |
parent | 4f82199befee194aa924fd4dcdb2f4aad1f7dab6 (diff) | |
download | CMake-efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8.zip CMake-efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8.tar.gz CMake-efaaa729aa1c4ab2c351e7fb5ed5ea8712957db8.tar.bz2 |
Merge topic 'genex-complang-not-loaded'
4f82199bef Genex: Allow COMPILE_LANGUAGE to name a language that is not loaded
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2031
4 files changed, 1 insertions, 19 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 399e894..7b35bce 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1013,16 +1013,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode return std::string(); } - std::vector<std::string> enabledLanguages; cmGlobalGenerator* gg = context->LG->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("Makefiles") == std::string::npos && genName.find("Ninja") == std::string::npos && diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt deleted file mode 100644 index 444da45..0000000 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> Unknown language. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake index cec12a3..00dd290 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -1,4 +1,4 @@ enable_language(C) add_executable(empty empty.c) -target_compile_options(empty PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wall>) +target_compile_options(empty PRIVATE $<$<COMPILE_LANGUAGE:CXX>:$<TARGET_EXISTS:too,many,parameters>>) |