From 1a7b8c83210c2574652c5045e3338a7ccba03734 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 26 Sep 2017 07:14:38 -0400 Subject: 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 --- Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake | 3 +++ Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt | 3 +++ Tests/RunCMake/GetPrerequisites/TargetMissing.cmake | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt create mode 100644 Tests/RunCMake/GetPrerequisites/TargetMissing.cmake (limited to 'Tests/RunCMake/GetPrerequisites') diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake new file mode 100644 index 0000000000..3856c54b6d --- /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 0000000000..cffe5f8049 --- /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 0000000000..84fd32ce12 --- /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}'") -- cgit v1.2.1