diff options
author | Brad King <brad.king@kitware.com> | 2024-02-13 21:45:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-02-14 13:51:48 (GMT) |
commit | 86698eea854bb779dd45f067a05fdad6068561e7 (patch) | |
tree | cdf8d903855cc85549078b30887180d1f9955b4f /Tests | |
parent | a3033d1a063c0f9611c71738e9116f78d04daf97 (diff) | |
download | CMake-86698eea854bb779dd45f067a05fdad6068561e7.zip CMake-86698eea854bb779dd45f067a05fdad6068561e7.tar.gz CMake-86698eea854bb779dd45f067a05fdad6068561e7.tar.bz2 |
cmake_language: Fix EXIT inside control flow blocks
These were missed in commit 1bb1769235 (cmake_language: Add EXIT
subcommand, 2024-01-05, v3.29.0-rc1~112^2).
Fixes: #25674
Diffstat (limited to 'Tests')
15 files changed, 70 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake index ac4aec8..5fb2de6 100644 --- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake @@ -91,6 +91,13 @@ run_cmake_script(exit_5_script) run_cmake_script(exit_0_script_with_command) run_cmake_script(exit_7_script_in_include) run_cmake_script(exit_8_script_in_recursive_cmake_language) +run_cmake_script(exit_9_script_block) +run_cmake_script(exit_9_script_control) +run_cmake_script(exit_9_script_if) +run_cmake_script(exit_9_script_foreach) +run_cmake_script(exit_9_script_function) +run_cmake_script(exit_9_script_macro) +run_cmake_script(exit_9_script_while) # Default log level run_cmake_command( diff --git a/Tests/RunCMake/cmake_language/exit_9_script_block-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_block-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_block-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_block.cmake b/Tests/RunCMake/cmake_language/exit_9_script_block.cmake new file mode 100644 index 0000000..b8d8615 --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_block.cmake @@ -0,0 +1,5 @@ +block() + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endblock() +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/cmake_language/exit_9_script_control-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_control-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_control-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_control.cmake b/Tests/RunCMake/cmake_language/exit_9_script_control.cmake new file mode 100644 index 0000000..168f81f --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_control.cmake @@ -0,0 +1,24 @@ +function(exit_macro) + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endfunction() + +function(exit_function) + exit_macro() + message(FATAL_ERROR "This should not be reached!") +endfunction() + +block() + if(1) + foreach(i IN ITEMS a b) + while(1) + exit_function() + message(FATAL_ERROR "This should not be reached!") + endwhile() + message(FATAL_ERROR "This should not be reached!") + endforeach() + message(FATAL_ERROR "This should not be reached!") + endif() + message(FATAL_ERROR "This should not be reached!") +endblock() +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/cmake_language/exit_9_script_foreach-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_foreach-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_foreach-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_foreach.cmake b/Tests/RunCMake/cmake_language/exit_9_script_foreach.cmake new file mode 100644 index 0000000..b205537 --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_foreach.cmake @@ -0,0 +1,5 @@ +foreach(i IN ITEMS a b) + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endforeach() +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/cmake_language/exit_9_script_function-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_function-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_function-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_function.cmake b/Tests/RunCMake/cmake_language/exit_9_script_function.cmake new file mode 100644 index 0000000..67a2615 --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_function.cmake @@ -0,0 +1,6 @@ +function(exit) + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endfunction() +exit() +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/cmake_language/exit_9_script_if-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_if-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_if-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_if.cmake b/Tests/RunCMake/cmake_language/exit_9_script_if.cmake new file mode 100644 index 0000000..935b8d5 --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_if.cmake @@ -0,0 +1,5 @@ +if(1) + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endif() +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/cmake_language/exit_9_script_macro-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_macro-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_macro-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_macro.cmake b/Tests/RunCMake/cmake_language/exit_9_script_macro.cmake new file mode 100644 index 0000000..133348c --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_macro.cmake @@ -0,0 +1,6 @@ +macro(exit) + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endmacro() +exit() +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/cmake_language/exit_9_script_while-result.txt b/Tests/RunCMake/cmake_language/exit_9_script_while-result.txt new file mode 100644 index 0000000..b38a53d --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_while-result.txt @@ -0,0 +1 @@ +^9$ diff --git a/Tests/RunCMake/cmake_language/exit_9_script_while.cmake b/Tests/RunCMake/cmake_language/exit_9_script_while.cmake new file mode 100644 index 0000000..261438c --- /dev/null +++ b/Tests/RunCMake/cmake_language/exit_9_script_while.cmake @@ -0,0 +1,5 @@ +while(1) + cmake_language(EXIT 9) + message(FATAL_ERROR "This should not be reached!") +endwhile() +message(FATAL_ERROR "This should not be reached!") |