summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-09-26 11:14:38 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-26 11:31:33 (GMT)
commit1a7b8c83210c2574652c5045e3338a7ccba03734 (patch)
tree2b375bfe6bce75d12b121797bb46c7d9e76eaa4e /Tests/RunCMake
parenteae3765b67b653d3f00afa44a60719a387262af8 (diff)
downloadCMake-1a7b8c83210c2574652c5045e3338a7ccba03734.zip
CMake-1a7b8c83210c2574652c5045e3338a7ccba03734.tar.gz
CMake-1a7b8c83210c2574652c5045e3338a7ccba03734.tar.bz2
GetPrerequisites: Restore behavior on missing binary of not clearing list
Prior to commit v3.4.0-rc1~264^2~1 (GetPrerequisites: Add error checks for execute_process() calls, 2015-07-29), `get_prerequisites` would simply warn on a missing binary and not update the result list at all. That commit accidentally made the case an error. This was fixed by commit v3.8.0-rc1~110^2 (GetPrerequisites: Do not fail on files we cannot find, 2017-01-10), but the fix also cleared the result list. Clearing the list is incorrect because it is supposed to be able to accumulate results over multiple calls. Remove the list clearing behavior to restore the original behavior on a missing binary. Fixes: #17306
Diffstat (limited to 'Tests/RunCMake')
-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
4 files changed, 11 insertions, 0 deletions
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}'")