CMake: fix running of headersclean targets when CMAKE_CXX_FLAGS is set

We were passing the full option from the user as a single string in the
command-line to the compiler.

clang++ -c "-O3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes" [...]
error: invalid integral value '3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes' in '-O3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes'

Pick-to: 6.2 6.3
Fixes: QTBUG-100315
Change-Id: I6fcda969a9e9427198bffffd16ce83150d4e4263
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Thiago Macieira 2022-01-28 10:37:20 -08:00
parent 2c008d6faf
commit 05e029619f

View File

@ -133,7 +133,7 @@ function(qt_internal_add_headers_clean_target
# Use strict mode C++20, with no GNU extensions (see -pedantic-errors above).
list(APPEND hcleanFLAGS -std=c++2a)
set(cxx_flags ${CMAKE_CXX_FLAGS})
separate_arguments(cxx_flags NATIVE_COMMAND ${CMAKE_CXX_FLAGS})
if(APPLE AND CMAKE_OSX_SYSROOT)
list(APPEND cxx_flags "${CMAKE_CXX_SYSROOT_FLAG}" "${CMAKE_OSX_SYSROOT}")