CMake: Fix build with CMake master / 3.22

CMake master / 3.22 introduced a behavior change in how conditions are
evaluated in the while command. It is now consistent with how if()
evaluates conditions.

This caused an issue in Qt code where a "(" opening parenthesis was
evaluated as part of the condition rather than as a string.

Fix this by wrapping the evaluation of the variable in quotes.

Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
(cherry picked from commit eb2282605734152440e840777d1f8a0576e3c7a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2021-08-09 12:44:34 +02:00 committed by Qt Cherry-pick Bot
parent 2c5de45781
commit 09838d9cbd

View File

@ -137,7 +137,7 @@ function(qt_remove_args out_var)
endif()
list(GET result ${find_result} arg_current)
# 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)
while(NOT "${arg_current}" IN_LIST arg_ALL_ARGS AND find_result LESS result_len)
list(REMOVE_AT result ${find_result})
list(LENGTH result result_len)
if (NOT find_result EQUAL result_len)