diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake index 9c5aee5d90..b36f6cff0c 100644 --- a/cmake/QtFlagHandlingHelpers.cmake +++ b/cmake/QtFlagHandlingHelpers.cmake @@ -235,7 +235,8 @@ function(qt_set_msvc_cplusplus_options target visibility) # For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus. # Check qt_config_compile_test for more info. if(MSVC AND MSVC_VERSION GREATER_EQUAL 1913) - target_compile_options("${target}" ${visibility} "-Zc:__cplusplus" "-permissive-") + set(flags "-Zc:__cplusplus" "-permissive-") + target_compile_options("${target}" ${visibility} "$<$:${flags}>") endif() endfunction() @@ -247,7 +248,11 @@ function(qt_enable_utf8_sources target) if(utf8_flags) # Allow opting out by specifying the QT_NO_UTF8_SOURCE target property. - set(genex_condition "$>>") + set(opt_out_condition "$>>") + # Only set the compiler option for C and C++. + set(language_condition "$") + # Compose the full condition. + set(genex_condition "$") set(utf8_flags "$<${genex_condition}:${utf8_flags}>") target_compile_options("${target}" INTERFACE "${utf8_flags}") endif()