summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/GetPrerequisites.cmake1
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt3
-rw-r--r--Tests/RunCMake/GetPrerequisites/TargetMissing.cmake4
5 files changed, 11 insertions, 1 deletions
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 4e52cb3..b81dd76 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -659,7 +659,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(NOT EXISTS "${target}")
message("warning: target '${target}' does not exist...")
- set(${prerequisites_var} "" PARENT_SCOPE)
return()
endif()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index aa4c5ac..5622f8e 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -147,6 +147,7 @@ endif()
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorPlatform)
add_RunCMake_test(GeneratorToolset)
+add_RunCMake_test(GetPrerequisites)
add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test
add_RunCMake_test(TargetPropertyGeneratorExpressions)
diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
new file mode 100644
index 0000000..3856c54
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
new file mode 100644
index 0000000..cffe5f8
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
@@ -0,0 +1,3 @@
+^warning: target 'does_not_exist' is not absolute\.\.\.
+warning: target 'does_not_exist' does not exist\.\.\.
+result_var='value;before;call'$
diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
new file mode 100644
index 0000000..84fd32c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
@@ -0,0 +1,4 @@
+include(GetPrerequisites)
+set(result_var value before call)
+get_prerequisites(does_not_exist result_var 0 0 "" "")
+message("result_var='${result_var}'")