summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-10-08 22:29:04 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-11-10 20:01:49 +0100
commit8780fbb2ebff82f6e9b2dbae9a523d094d327b32 (patch)
treefc613f07ba6e32bdeda5184a0a47b006ed8ac61c /cmake
parentef051a61f6e458cb89b6ef20b5d55cb1e001dd93 (diff)
Build Qt (and client apps using it) with /permissive-
*Not* using /permissive- exposes Qt and client apps to interesting bugs and/or build failures, (e.g. QTBUG-87225, or 19b5520abfb5f66d4b83c7a18cc72d68673d098a). We demand strict conformance by any other compiler, it's time to demand it from MSVC too. The Windows headers themselves are clean starting from the Windows Fall Creators SDK (10.0.16299.0), and moreover Qt 6 will drop WinRT; therefore, the comment in the mkspecs does not apply any more. Since /permissive- implies /Zc:referenceBinding, drop that option. The other implied options are set on MSVC < 2017, but I leave them in to avoid tinkering with the fragile lists of C/C++ flags. Rename the CMake internal helper function to better describe what it does. Fixes: QTBUG-85633 Fixes: QTBUG-85637 Fixes: QTBUG-85635 Fixes: QTBUG-88244 Change-Id: Ie03fddb61aa066fdc14b7231c22e7108b4a02fbb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFlagHandlingHelpers.cmake4
-rw-r--r--cmake/QtPublicTargetsHelpers.cmake2
2 files changed, 3 insertions, 3 deletions
diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake
index b9835a3639..250df5de2d 100644
--- a/cmake/QtFlagHandlingHelpers.cmake
+++ b/cmake/QtFlagHandlingHelpers.cmake
@@ -228,11 +228,11 @@ function(qt_set_language_standards_interface_compile_features target)
target_compile_features("${target}" INTERFACE ${cpp_feature})
endfunction()
-function(qt_enable_msvc_cplusplus_define target visibility)
+function(qt_set_msvc_cplusplus_options target visibility)
# For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus.
# Check qt_config_compile_test for more info.
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1913)
- target_compile_options("${target}" ${visibility} "-Zc:__cplusplus")
+ target_compile_options("${target}" ${visibility} "-Zc:__cplusplus" "-permissive-")
endif()
endfunction()
diff --git a/cmake/QtPublicTargetsHelpers.cmake b/cmake/QtPublicTargetsHelpers.cmake
index 8d916535ac..2e5eb564f4 100644
--- a/cmake/QtPublicTargetsHelpers.cmake
+++ b/cmake/QtPublicTargetsHelpers.cmake
@@ -20,7 +20,7 @@ function(qt_internal_setup_public_platform_target)
target_link_libraries(Platform INTERFACE log)
endif()
- qt_enable_msvc_cplusplus_define(Platform INTERFACE)
+ qt_set_msvc_cplusplus_options(Platform INTERFACE)
# Propagate minimum C++ 17 via Platform to Qt consumers (apps), after the global features
# are computed.