CMake: Guard some MSVC flags not understood by clang-cl frontend
Due to various reasons, Qt WebEngine needs to be built with clang-cl, while qtbase and other dependencies with MSVC. clang-cl does not understand all MSVC-style options, which are recorded and propagated through the PlatformCommonInternal target which is configured in qtbase using MSVC. Guard the flags that are not understood by clang-cl with a genex condition that checks that the compiler is not clang (which implies clang-cl, because afaik it's not possible to use gcc frontend of clang against an MSVC-built qtbase). Change-Id: Ibf2c96399a8322ce13814c9c6afa5b57fd8885be Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Zhao Yuhang <2546789017@qq.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 515ad07a12c4bf190545ae38eff588f7b979d68e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1487d7edb3
commit
5a9f324a46
@ -262,6 +262,13 @@ endif()
|
||||
# Taken from mkspecs/common/msvc-version.conf and mkspecs/common/msvc-desktop.conf
|
||||
if (MSVC AND NOT CLANG)
|
||||
if (MSVC_VERSION GREATER_EQUAL 1799)
|
||||
set_target_properties(PlatformCommonInternal PROPERTIES _qt_cpp_compiler_frontend_variant
|
||||
"${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}")
|
||||
|
||||
# Protect against adding these flags when building qtbase with MSVC, and qtwebengine using
|
||||
# clang-cl.
|
||||
set(is_not_clang_cl_start "$<$<NOT:$<STREQUAL:$<CXX_COMPILER_ID>,Clang>>:")
|
||||
set(is_not_clang_cl_end ">")
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-FS
|
||||
-Zc:rvalueCast
|
||||
@ -271,18 +278,18 @@ if (MSVC AND NOT CLANG)
|
||||
if (MSVC_VERSION GREATER_EQUAL 1899)
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:strictStrings
|
||||
-Zc:throwingNew
|
||||
"${is_not_clang_cl_start}-Zc:throwingNew${is_not_clang_cl_end}"
|
||||
)
|
||||
endif()
|
||||
if (MSVC_VERSION GREATER_EQUAL 1909) # MSVC 2017
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:referenceBinding
|
||||
"${is_not_clang_cl_start}-Zc:referenceBinding${is_not_clang_cl_end}"
|
||||
-Zc:ternary
|
||||
)
|
||||
endif()
|
||||
if (MSVC_VERSION GREATER_EQUAL 1919) # MSVC 2019
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:externConstexpr
|
||||
"${is_not_clang_cl_start}-Zc:externConstexpr${is_not_clang_cl_end}"
|
||||
#-Zc:lambda # Buggy. TODO: Enable again when stable enough.
|
||||
#-Zc:preprocessor # breaks build due to bug in default Windows SDK 10.0.19041
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user