determine msvc compat version in clang spec dynamically
instead of hardcoding the compat version in the spec, run cl.exe (which needs to be around anyway) to figure out what version to emulate. Change-Id: I6eae97fe9a78f8e340ecdabcdc0d48738497c6d2 Started-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
1b5271f27f
commit
5196d5602c
@ -80,7 +80,23 @@ else: \
|
||||
|
||||
isEmpty($${target_prefix}.COMPILER_MACROS) {
|
||||
msvc {
|
||||
vars = $$qtVariablesFromMSVC($$QMAKE_CXX $$QMAKE_CXXFLAGS)
|
||||
clang_cl {
|
||||
# We need to obtain the cl.exe version first
|
||||
vars = $$qtVariablesFromMSVC(cl)
|
||||
for (v, vars) {
|
||||
isEmpty(v)|contains(v, $${LITERAL_HASH}.*): next()
|
||||
eval($$v)
|
||||
}
|
||||
isEmpty(QMAKE_MSC_FULL_VER): error("Could not determine the Visual Studio version")
|
||||
|
||||
QMAKE_CFLAGS_MSVC_COMPAT = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", \
|
||||
"-fms-compatibility-version=\\1.\\2.\\3")
|
||||
cache($${target_prefix}.QMAKE_CFLAGS_MSVC_COMPAT, set stash, QMAKE_CFLAGS_MSVC_COMPAT)
|
||||
$${target_prefix}.COMPILER_MACROS += QMAKE_CFLAGS_MSVC_COMPAT
|
||||
vars = $$qtVariablesFromMSVC($$QMAKE_CXX, $$QMAKE_CFLAGS_MSVC_COMPAT)
|
||||
} else {
|
||||
vars = $$qtVariablesFromMSVC($$QMAKE_CXX)
|
||||
}
|
||||
} else: gcc {
|
||||
vars = $$qtVariablesFromGCC($$QMAKE_CXX)
|
||||
}
|
||||
@ -134,3 +150,6 @@ unset(target_prefix)
|
||||
__GNUC__=$$QT_GCC_MAJOR_VERSION \
|
||||
__GNUC_MINOR__=$$QT_GCC_MINOR_VERSION \
|
||||
__GNUC_PATCHLEVEL__=$$QT_GCC_PATCH_VERSION
|
||||
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_MSVC_COMPAT
|
||||
|
@ -15,7 +15,7 @@ QMAKE_COMPILER += clang_cl llvm
|
||||
QMAKE_CC = clang-cl
|
||||
QMAKE_CXX = $$QMAKE_CC
|
||||
|
||||
QMAKE_CFLAGS += -fms-compatibility-version=19.00.23506 -Wno-microsoft-enum-value
|
||||
QMAKE_CFLAGS += -Wno-microsoft-enum-value
|
||||
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
|
||||
|
||||
# Precompiled headers are not supported yet by clang
|
||||
|
Loading…
Reference in New Issue
Block a user