diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c5825fe6c..8e6bad40c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -110,6 +110,7 @@ add_RunCMake_test(include_directories) add_RunCMake_test(list) add_RunCMake_test(message) add_RunCMake_test(project) +add_RunCMake_test(return) add_RunCMake_test(string) add_RunCMake_test(try_compile) add_RunCMake_test(set) diff --git a/Tests/RunCMake/return/CMakeLists.txt b/Tests/RunCMake/return/CMakeLists.txt new file mode 100644 index 000000000..ef2163c29 --- /dev/null +++ b/Tests/RunCMake/return/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/return/ReturnFromForeach-result.txt b/Tests/RunCMake/return/ReturnFromForeach-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/return/ReturnFromForeach-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/return/ReturnFromForeach.cmake b/Tests/RunCMake/return/ReturnFromForeach.cmake new file mode 100644 index 000000000..c71cf33d1 --- /dev/null +++ b/Tests/RunCMake/return/ReturnFromForeach.cmake @@ -0,0 +1,10 @@ +function(foo) + foreach(i RANGE 1 3) + foreach(j RANGE 1 3) + return() + message(FATAL_ERROR "unexpected") + endforeach() + endforeach() +endfunction(foo) + +foo() diff --git a/Tests/RunCMake/return/RunCMakeTest.cmake b/Tests/RunCMake/return/RunCMakeTest.cmake new file mode 100644 index 000000000..2cc6c9d32 --- /dev/null +++ b/Tests/RunCMake/return/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(ReturnFromForeach)