summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorYuhang Zhao <2546789017@qq.com>2022-08-25 10:36:48 +0800
committerMarc Mutz <marc.mutz@qt.io>2022-10-15 13:34:20 +0000
commit8cb832090a8a0e7226904561f97c6de954d752ed (patch)
treeb6212a59462b3eff672ec67b92ce9f0fe99afd9c /cmake
parent0a4d0ac013c276f32c23d9a7f51d88a853fc60df (diff)
MSVC: Enable all possible conformance checks
For the full list, please refer to [1]. Needed to change the qstringapisymmetry unit test: In theory we don't need the array to be static and it did compile without any problems so far, indeed. However, with this patch applied, MSVC complains that the lambda function below can't access the array. I don't understand why, because we use [&] in the lambda and it should capture all the variables in theory, but in reality it failed to capture this variable in the end. And making the variable static solves this issue. Maybe it's a MSVC bug. Already tested locally. Most Qt repos build without any issues, only very few repos are not tested, as my local environment can't build them. [1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-conformance?view=msvc-170 Change-Id: I658427aa171ee1ae26610d0c68640b2f50789f15 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtInternalTargets.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index 13da9775f0..9dbf63000c 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -239,14 +239,17 @@ if (MSVC)
)
endif()
endif()
- if (MSVC_VERSION GREATER_EQUAL 1909 AND NOT CLANG)
+ if (MSVC_VERSION GREATER_EQUAL 1909 AND NOT CLANG) # MSVC 2017
target_compile_options(PlatformCommonInternal INTERFACE
-Zc:referenceBinding
+ -Zc:ternary
)
endif()
- if (MSVC_VERSION GREATER_EQUAL 1919 AND NOT CLANG)
+ if (MSVC_VERSION GREATER_EQUAL 1919 AND NOT CLANG) # MSVC 2019
target_compile_options(PlatformCommonInternal INTERFACE
-Zc:externConstexpr
+ -Zc:lambda
+ -Zc:preprocessor
)
endif()