mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-17 12:40:40 -06:00
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
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
3
Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
Normal file
3
Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
|
||||
3
Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
Normal file
3
Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
Normal file
@@ -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'$
|
||||
4
Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
Normal file
4
Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
Normal file
@@ -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}'")
|
||||
Reference in New Issue
Block a user