Make sure that -utf-8 flag only apply to MSVC

INTERFACE scope propagates the '-utf-8' flag to the target dependencies.
So if Qt is built using MSVC, but the depending targets use different
compiler this flag will break the compilation.

Guard the flag using genex.

Amends e3cc2487ce63cae42d8054b38fdb54abe8545007

Task-number: QTBUG-112737
Change-Id: Ie0576667108820dd61035debfc1fcc030ef3536a
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c33427240f1e7e99a36d4c8fff19975ebe508839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2023-05-12 16:23:15 +02:00 committed by Qt Cherry-pick Bot
parent 99efba4e29
commit cc2b50846a

View File

@ -295,7 +295,7 @@ endfunction()
function(qt_enable_utf8_sources target) function(qt_enable_utf8_sources target)
set(utf8_flags "") set(utf8_flags "")
if(MSVC) if(MSVC)
list(APPEND utf8_flags "-utf-8") list(APPEND utf8_flags "$<$<CXX_COMPILER_ID:MSVC>:-utf-8>")
endif() endif()
if(utf8_flags) if(utf8_flags)