diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-04-27 17:54:42 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-05-04 13:33:35 (GMT) |
commit | 627ef4c1d002cf642ef0ef9048c5e3fa24069516 (patch) | |
tree | 810f7b1cd4c27b9e20fee545147b25192fcd3de9 /Tests | |
parent | 1d82670bd4daff26d0d0169820b289bc401f4943 (diff) | |
download | CMake-627ef4c1d002cf642ef0ef9048c5e3fa24069516.zip CMake-627ef4c1d002cf642ef0ef9048c5e3fa24069516.tar.gz CMake-627ef4c1d002cf642ef0ef9048c5e3fa24069516.tar.bz2 |
Provide guidance when trying to use non-enabled language
Fixes #23463
Diffstat (limited to 'Tests')
4 files changed, 11 insertions, 0 deletions
diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt new file mode 100644 index 0000000..bf9157b --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + The language CXX was requested for compilation but was not enabled. To + enable a language it needs to be specified in a 'project' or + 'enable_language' command in the root CMakeLists.txt diff --git a/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake b/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake new file mode 100644 index 0000000..caab687 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUsedButNotEnabled.cmake @@ -0,0 +1,3 @@ + +add_executable(UsesCXXLang empty.cxx) +set_source_files_properties(empty.cxx PROPERTIES GENERATED TRUE LANGUAGE CXX ) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 349e8ac..d7dab12 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -8,6 +8,9 @@ run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) run_cmake(LanguagesTwice) run_cmake(LanguagesUnordered) +if(RunCMake_GENERATOR MATCHES "Make|Ninja") + run_cmake(LanguagesUsedButNotEnabled) +endif() run_cmake(ProjectDescription) run_cmake(ProjectDescription2) run_cmake(ProjectDescriptionNoArg) |