From 79665b067c9dd6344b84dd1b72afae401608fd87 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 21 May 2019 09:30:05 +0200 Subject: Don't enable QT_STRICT_ITERATORS on Windows. Summary: Strict iterators can't be used on Windows, they lead to a link error when application code iterates over a QVector for instance, unless Qt itself was also built with strict iterators. See example at https://bugreports.qt.io/browse/AUTOSUITE-946 Technically this would be fine for mingw, but not for MSVC neither clang-cl (which also uses the MSVC ABI). I think it's fine to just disable it for all Windows compilers, since any iterators misuse will be detected on Unix anyway. Test Plan: None, I'm relying on Volker's findings. Reviewers: vkrause, dvratil Reviewed By: dvratil Subscribers: apol, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D21314 --- kde-modules/KDEFrameworkCompilerSettings.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'kde-modules/KDEFrameworkCompilerSettings.cmake') diff --git a/kde-modules/KDEFrameworkCompilerSettings.cmake b/kde-modules/KDEFrameworkCompilerSettings.cmake index d2db5e56..3d1bba53 100644 --- a/kde-modules/KDEFrameworkCompilerSettings.cmake +++ b/kde-modules/KDEFrameworkCompilerSettings.cmake @@ -55,9 +55,16 @@ add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT - -DQT_STRICT_ITERATORS ) +if (NOT WIN32) + # Strict iterators can't be used on Windows, they lead to a link error + # when application code iterates over a QVector for instance, unless + # Qt itself was also built with strict iterators. + # See example at https://bugreports.qt.io/browse/AUTOSUITE-946 + add_definitions(-DQT_STRICT_ITERATORS) +endif() + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") endif() -- cgit v1.2.1