diff --git a/cmake/QtCMakeHelpers.cmake b/cmake/QtCMakeHelpers.cmake index b6acde5f554..93513d4369b 100644 --- a/cmake/QtCMakeHelpers.cmake +++ b/cmake/QtCMakeHelpers.cmake @@ -131,6 +131,10 @@ function(qt_remove_args out_var) # remove arg list(REMOVE_AT result ${find_result}) list(LENGTH result result_len) + if(find_result EQUAL result_len) + # We removed the last argument, could have been an option keyword + continue() + 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)