From d0bc2cefd2d37e18415c0aaebcb07597e3b54a72 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 27 Oct 2020 11:25:34 +0100 Subject: [PATCH] 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 Reviewed-by: Alexandru Croitor --- cmake/QtCMakeHelpers.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/QtCMakeHelpers.cmake b/cmake/QtCMakeHelpers.cmake index 261e9cc4574..6c62897d203 100644 --- a/cmake/QtCMakeHelpers.cmake +++ b/cmake/QtCMakeHelpers.cmake @@ -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()