From b0f78c22bde854ee34f8e2b6d219e82759f55e53 Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Mon, 8 May 2023 16:19:35 +0200 Subject: [PATCH] Make sure that -Zc:__cplusplus, and -permissive- only apply to MSVC As described in the bug report, in cases where host Qt is built using MSVC, these flags may leak to user projects if they are set to be configured by a different compiler, e.g., Clang. Pick-to: 6.5 Fixes: QTBUG-112737 Change-Id: Iad922e24cc7e7f835e08ed37271dfbedc6e38dbe Reviewed-by: Alexey Edelev Reviewed-by: Qt CI Bot --- cmake/QtFlagHandlingHelpers.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake index 806174521d7..fa478137926 100644 --- a/cmake/QtFlagHandlingHelpers.cmake +++ b/cmake/QtFlagHandlingHelpers.cmake @@ -280,7 +280,8 @@ function(qt_set_msvc_cplusplus_options target visibility) # Check qt_config_compile_test for more info. if(MSVC AND MSVC_VERSION GREATER_EQUAL 1913) set(flags "-Zc:__cplusplus" "-permissive-") - target_compile_options("${target}" ${visibility} "$<$:${flags}>") + target_compile_options("${target}" ${visibility} + "$<$,$>:${flags}>") endif() endfunction()