CMake: Do not overrun the list end in qt_remove_args

Otherwise we get error messages from CMake.

Change-Id: I374b87e38550062b841b7eacf5fbb6bb5ccbdbde
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Ulf Hermann 2020-10-27 11:25:34 +01:00
parent 6d496a2421
commit d0bc2cefd2

View File

@ -132,11 +132,13 @@ function(qt_remove_args out_var)
list(REMOVE_AT result ${find_result})
list(LENGTH result result_len)
list(GET result ${find_result} arg_current)
# remove values until we hit another arg
# remove values until we hit another arg or the end of the list
while(NOT ${arg_current} IN_LIST arg_ALL_ARGS AND find_result LESS result_len)
list(REMOVE_AT result ${find_result})
list(GET result ${find_result} arg_current)
list(LENGTH result result_len)
if (NOT find_result EQUAL result_len)
list(GET result ${find_result} arg_current)
endif()
endwhile()
endif()
endforeach()