diff options
author | Brad King <brad.king@kitware.com> | 2022-07-06 13:16:25 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-07-06 13:16:34 (GMT) |
commit | b80ccea6869e7ddea6233e982c9ff4e203d393a2 (patch) | |
tree | 094a06baa46c07eda6296627fc26ae12a90c3809 /Tests | |
parent | 2f561f0e247e96f716e77443a9afdad8ba1a970b (diff) | |
parent | e3c8012ccd067c90408502eef7631badd60f67e0 (diff) | |
download | CMake-b80ccea6869e7ddea6233e982c9ff4e203d393a2.zip CMake-b80ccea6869e7ddea6233e982c9ff4e203d393a2.tar.gz CMake-b80ccea6869e7ddea6233e982c9ff4e203d393a2.tar.bz2 |
Merge topic 'enable_language-deduplicate'
e3c8012ccd Help: Document enable_language accepting multiple languages
b4fd385c9b cmMakefile: Dedupe languages when enabling them
66bfe14309 cmMakefile: Refactor parameter and variable names for EnableLanguage
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7426
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/project/LanguagesDuplicate-check.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/project/LanguagesDuplicate.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/project/RunCMakeTest.cmake | 5 |
3 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/project/LanguagesDuplicate-check.cmake b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake new file mode 100644 index 0000000..31c7da3 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake @@ -0,0 +1,10 @@ +if(NOT actual_stderr MATCHES "The following language has been specified multiple times: C\n") + set(RunCMake_TEST_FAILED "'LANGUAGES C C C' should report only 'C' and only once.") +endif() + +if(NOT actual_stderr MATCHES "The following languages have been specified multiple times: C, CXX\n") + if(RunCMake_TEST_FAILED) + string(APPEND RunCMake_TEST_FAILED "\n") + endif() + string(APPEND RunCMake_TEST_FAILED "'LANGUAGES C C CXX CXX' should report 'C' and 'CXX'.") +endif() diff --git a/Tests/RunCMake/project/LanguagesDuplicate.cmake b/Tests/RunCMake/project/LanguagesDuplicate.cmake new file mode 100644 index 0000000..97a79d0 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesDuplicate.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0057 NEW) + +project(ProjectA C C C) +project(ProjectB C C CXX CXX) + +get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang C CXX) + if(NOT lang IN_LIST langs) + message(FATAL_ERROR "Expected language '${lang}' to be enabled.") + endif() +endforeach() diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 945d9ed..6d9f52f 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -12,6 +12,11 @@ run_cmake_with_options(CodeInjection if(CMake_TEST_RESOURCES) run_cmake(ExplicitRC) endif() + +set(RunCMake_DEFAULT_stderr .) +run_cmake(LanguagesDuplicate) +unset(RunCMake_DEFAULT_stderr) + run_cmake(LanguagesImplicit) run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) |