aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2019-05-21 09:30:05 +0200
committerDavid Faure <faure@kde.org>2019-05-22 09:49:48 +0200
commit79665b067c9dd6344b84dd1b72afae401608fd87 (patch)
tree08f7b7e2779f1cd0186ae520fc94b8b6ed421ef0
parent7f2760a07ee7f8a7f484ab048883b9374add8733 (diff)
downloadextra-cmake-modules-79665b067c9dd6344b84dd1b72afae401608fd87.tar.gz
extra-cmake-modules-79665b067c9dd6344b84dd1b72afae401608fd87.tar.bz2
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<QPoint> 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
-rw-r--r--kde-modules/KDEFrameworkCompilerSettings.cmake9
1 files changed, 8 insertions, 1 deletions
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<QPoint> 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()