Turn on -utf-8 compiler option for msvc2015 update 2 and up

Building qt with msvc would fail with the -developer-build configure
option turned on under simplified chinese locale.
This is because msvc will emit warnings for source files with utf-8
characters which are not representable in CP936, and -developer-build
implies treating warnings as errors.
This patch turn on -utf-8 compiler option for msvc2015 update 2
and up only for building qt.

Task-number: QTBUG-58161
Change-Id: If38ea11eb1f39f8e08efa1cccb92e0eea50daf92
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Jian Liang 2017-01-30 16:13:59 +08:00 committed by jian liang
parent 47cded3e6f
commit 015b53e9b4
3 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,12 @@ greaterThan(QMAKE_MSC_VER, 1899) {
QMAKE_CFLAGS_AVX2 = -arch:AVX2
QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew
QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -wd4467
greaterThan(QMAKE_MSC_FULL_VER, 190023918):!intel_icl {
isEmpty(QT_CLANG_MAJOR_VERSION)|!lessThan(QT_CLANG_MAJOR_VERSION, 4) {
QMAKE_CFLAGS_UTF8_SOURCE = -utf-8
}
}
}
greaterThan(QMAKE_MSC_VER, 1909) {

View File

@ -116,6 +116,11 @@ c++11|c++14|c++1z {
unset(cxxstd)
}
utf8_source {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE
}
!precompile_header: SOURCES += $$NO_PCH_SOURCES
QMAKE_INCDIR += $$QMAKE_INCDIR_POST

View File

@ -84,6 +84,7 @@ android|uikit|winrt: \
CONFIG += builtin_testdata
CONFIG += \
utf8_source \
create_prl link_prl \
prepare_docs qt_docs_targets \
no_private_qt_headers_warning QTDIR_build \