summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-10-24 15:20:27 +0200
committerTobias Hunger <tobias.hunger@qt.io>2018-11-01 11:48:46 +0000
commite9c45bbdddd4df005bdaa5eea9740d351e6eaea2 (patch)
tree23765d4650f8f349d1f32e0fe4b1bc678cae7568 /cmake
parent345e6b0213b1273b698163064f80d33bc7ce64a9 (diff)
Begin port of qtbase to CMake
Done-by: Alexandru Croitor <alexandru.croitor@qt.io> Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Done-by: Kevin Funk <kevin.funk@kdab.com> Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Done-by: Simon Hausmann <simon.hausmann@qt.io> Done-by: Tobias Hunger <tobias.hunger@qt.io> Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-by: Volker Krause <volker.krause@kdab.com> Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/3rdparty/extra-cmake-modules/COPYING-CMAKE-SCRIPTS22
-rw-r--r--cmake/3rdparty/extra-cmake-modules/find-modules/ECMFindModuleHelpersStub.cmake1
-rw-r--r--cmake/3rdparty/extra-cmake-modules/find-modules/FindWayland.cmake143
-rw-r--r--cmake/3rdparty/extra-cmake-modules/find-modules/FindX11_XCB.cmake118
-rw-r--r--cmake/3rdparty/extra-cmake-modules/find-modules/FindXCB.cmake201
-rw-r--r--cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake173
-rw-r--r--cmake/3rdparty/extra-cmake-modules/modules/ECMFindModuleHelpers.cmake297
-rw-r--r--cmake/3rdparty/extra-cmake-modules/qt_attribution.json15
-rw-r--r--cmake/3rdparty/kwin/COPYING-CMAKE-SCRIPTS22
-rw-r--r--cmake/3rdparty/kwin/FindFontconfig.cmake50
-rw-r--r--cmake/3rdparty/kwin/FindLibdrm.cmake126
-rw-r--r--cmake/3rdparty/kwin/FindLibinput.cmake125
-rw-r--r--cmake/3rdparty/kwin/FindXKB.cmake101
-rw-r--r--cmake/3rdparty/kwin/Findgbm.cmake125
-rw-r--r--cmake/3rdparty/kwin/qt_attribution.json17
-rw-r--r--cmake/FindAtomic.cmake37
-rw-r--r--cmake/FindGLib.cmake3
-rw-r--r--cmake/FindLibsystemd.cmake3
-rw-r--r--cmake/FindLibudev.cmake3
-rw-r--r--cmake/FindPCRE2.cmake13
-rw-r--r--cmake/FindWrapDoubleConversion.cmake36
-rw-r--r--cmake/Finddouble-conversion.cmake30
-rw-r--r--cmake/QtBaseConfigureTests.cmake139
-rw-r--r--cmake/QtBaseGlobalTargets.cmake58
-rw-r--r--cmake/QtBuild.cmake1080
-rw-r--r--cmake/QtCompilerOptimization.cmake106
-rw-r--r--cmake/QtConfig.cmake.in43
-rw-r--r--cmake/QtFeature.cmake435
-rw-r--r--cmake/QtModuleConfig.cmake.in9
-rw-r--r--cmake/QtPlatformSupport.cmake41
-rw-r--r--cmake/QtPostProcess.cmake32
-rw-r--r--cmake/QtSetup.cmake47
-rw-r--r--cmake/README.md103
-rw-r--r--cmake/tests/features/CMakeLists.txt42
-rw-r--r--cmake/tests/features/configure.cmake35
-rw-r--r--cmake/tests/features/src/CMakeLists.txt7
36 files changed, 3838 insertions, 0 deletions
diff --git a/cmake/3rdparty/extra-cmake-modules/COPYING-CMAKE-SCRIPTS b/cmake/3rdparty/extra-cmake-modules/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000000..4b417765f3
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/ECMFindModuleHelpersStub.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/ECMFindModuleHelpersStub.cmake
new file mode 100644
index 0000000000..bb8c9a62fc
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/find-modules/ECMFindModuleHelpersStub.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/../modules/ECMFindModuleHelpers.cmake)
diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/FindWayland.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/FindWayland.cmake
new file mode 100644
index 0000000000..233cc88d02
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/find-modules/FindWayland.cmake
@@ -0,0 +1,143 @@
+#.rst:
+# FindWayland
+# -----------
+#
+# Try to find Wayland.
+#
+# This is a component-based find module, which makes use of the COMPONENTS
+# and OPTIONAL_COMPONENTS arguments to find_module. The following components
+# are available::
+#
+# Client Server Cursor Egl
+#
+# If no components are specified, this module will act as though all components
+# were passed to OPTIONAL_COMPONENTS.
+#
+# This module will define the following variables, independently of the
+# components searched for or found:
+#
+# ``Wayland_FOUND``
+# TRUE if (the requested version of) Wayland is available
+# ``Wayland_VERSION``
+# Found Wayland version
+# ``Wayland_TARGETS``
+# A list of all targets imported by this module (note that there may be more
+# than the components that were requested)
+# ``Wayland_LIBRARIES``
+# This can be passed to target_link_libraries() instead of the imported
+# targets
+# ``Wayland_INCLUDE_DIRS``
+# This should be passed to target_include_directories() if the targets are
+# not used for linking
+# ``Wayland_DEFINITIONS``
+# This should be passed to target_compile_options() if the targets are not
+# used for linking
+#
+# For each searched-for components, ``Wayland_<component>_FOUND`` will be set to
+# TRUE if the corresponding Wayland library was found, and FALSE otherwise. If
+# ``Wayland_<component>_FOUND`` is TRUE, the imported target
+# ``Wayland::<component>`` will be defined. This module will also attempt to
+# determine ``Wayland_*_VERSION`` variables for each imported target, although
+# ``Wayland_VERSION`` should normally be sufficient.
+#
+# In general we recommend using the imported targets, as they are easier to use
+# and provide more control. Bear in mind, however, that if any target is in the
+# link interface of an exported library, it must be made available by the
+# package config file.
+#
+# Since pre-1.0.0.
+
+#=============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org>
+# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)
+
+ecm_find_package_version_check(Wayland)
+
+set(Wayland_known_components
+ Client
+ Server
+ Cursor
+ Egl
+)
+foreach(_comp ${Wayland_known_components})
+ string(TOLOWER "${_comp}" _lc_comp)
+ set(Wayland_${_comp}_component_deps)
+ set(Wayland_${_comp}_pkg_config "wayland-${_lc_comp}")
+ set(Wayland_${_comp}_lib "wayland-${_lc_comp}")
+ set(Wayland_${_comp}_header "wayland-${_lc_comp}.h")
+endforeach()
+set(Wayland_Egl_component_deps Client)
+
+ecm_find_package_parse_components(Wayland
+ RESULT_VAR Wayland_components
+ KNOWN_COMPONENTS ${Wayland_known_components}
+)
+ecm_find_package_handle_library_components(Wayland
+ COMPONENTS ${Wayland_components}
+)
+
+# If pkg-config didn't provide us with version information,
+# try to extract it from wayland-version.h
+# (Note that the version from wayland-egl.pc will probably be
+# the Mesa version, rather than the Wayland version, but that
+# version will be ignored as we always find wayland-client.pc
+# first).
+if(NOT Wayland_VERSION)
+ find_file(Wayland_VERSION_HEADER
+ NAMES wayland-version.h
+ HINTS ${Wayland_INCLUDE_DIRS}
+ )
+ mark_as_advanced(Wayland_VERSION_HEADER)
+ if(Wayland_VERSION_HEADER)
+ file(READ ${Wayland_VERSION_HEADER} _wayland_version_header_contents)
+ string(REGEX REPLACE
+ "^.*[ \t]+WAYLAND_VERSION[ \t]+\"([0-9.]*)\".*$"
+ "\\1"
+ Wayland_VERSION
+ "${_wayland_version_header_contents}"
+ )
+ unset(_wayland_version_header_contents)
+ endif()
+endif()
+
+find_package_handle_standard_args(Wayland
+ FOUND_VAR
+ Wayland_FOUND
+ REQUIRED_VARS
+ Wayland_LIBRARIES
+ VERSION_VAR
+ Wayland_VERSION
+ HANDLE_COMPONENTS
+)
+
+include(FeatureSummary)
+set_package_properties(Wayland PROPERTIES
+ URL "http://wayland.freedesktop.org"
+ DESCRIPTION "C library implementation of the Wayland protocol: a protocol for a compositor to talk to its clients"
+)
diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/FindX11_XCB.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/FindX11_XCB.cmake
new file mode 100644
index 0000000000..dd55fd7b30
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/find-modules/FindX11_XCB.cmake
@@ -0,0 +1,118 @@
+#.rst:
+# FindX11_XCB
+# -----------
+#
+# Try to find the X11 XCB compatibility library.
+#
+# This will define the following variables:
+#
+# ``X11_XCB_FOUND``
+# True if (the requested version of) libX11-xcb is available
+# ``X11_XCB_VERSION``
+# The version of libX11-xcb (this is not guaranteed to be set even when
+# X11_XCB_FOUND is true)
+# ``X11_XCB_LIBRARIES``
+# This can be passed to target_link_libraries() instead of the ``EGL::EGL``
+# target
+# ``X11_XCB_INCLUDE_DIR``
+# This should be passed to target_include_directories() if the target is not
+# used for linking
+# ``X11_XCB_DEFINITIONS``
+# This should be passed to target_compile_options() if the target is not
+# used for linking
+#
+# If ``X11_XCB_FOUND`` is TRUE, it will also define the following imported
+# target:
+#
+# ``X11::XCB``
+# The X11 XCB compatibility library
+#
+# In general we recommend using the imported target, as it is easier to use.
+# Bear in mind, however, that if the target is in the link interface of an
+# exported library, it must be made available by the package config file.
+#
+# Since pre-1.0.0.
+
+#=============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org>
+# Copyright 2011 Fredrik Höglund <fredrik@kde.org>
+# Copyright 2008 Helio Chissini de Castro <helio@kde.org>
+# Copyright 2007 Matthias Kretz <kretz@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)
+
+ecm_find_package_version_check(X11_XCB)
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig)
+pkg_check_modules(PKG_X11_XCB QUIET x11-xcb)
+
+set(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS_OTHER})
+set(X11_XCB_VERSION ${PKG_X11_XCB_VERSION})
+
+find_path(X11_XCB_INCLUDE_DIR
+ NAMES X11/Xlib-xcb.h
+ HINTS ${PKG_X11_XCB_INCLUDE_DIRS}
+)
+find_library(X11_XCB_LIBRARY
+ NAMES X11-xcb
+ HINTS ${PKG_X11_XCB_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(X11_XCB
+ FOUND_VAR
+ X11_XCB_FOUND
+ REQUIRED_VARS
+ X11_XCB_LIBRARY
+ X11_XCB_INCLUDE_DIR
+ VERSION_VAR
+ X11_XCB_VERSION
+)
+
+if(X11_XCB_FOUND AND NOT TARGET X11::XCB)
+ add_library(X11::XCB UNKNOWN IMPORTED)
+ set_target_properties(X11::XCB PROPERTIES
+ IMPORTED_LOCATION "${X11_XCB_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${X11_XCB_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X11_XCB_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARY)
+
+# compatibility variables
+set(X11_XCB_LIBRARIES ${X11_XCB_LIBRARY})
+set(X11_XCB_INCLUDE_DIRS ${X11_XCB_INCLUDE_DIR})
+set(X11_XCB_VERSION_STRING ${X11_XCB_VERSION})
+
+include(FeatureSummary)
+set_package_properties(X11_XCB PROPERTIES
+ URL "http://xorg.freedesktop.org/"
+ DESCRIPTION "A compatibility library for code that translates Xlib API calls into XCB calls"
+)
diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/FindXCB.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/FindXCB.cmake
new file mode 100644
index 0000000000..d530d2d7f4
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/find-modules/FindXCB.cmake
@@ -0,0 +1,201 @@
+#.rst:
+# FindXCB
+# -------
+#
+# Try to find XCB.
+#
+# This is a component-based find module, which makes use of the COMPONENTS and
+# OPTIONAL_COMPONENTS arguments to find_module. The following components are
+# available::
+#
+# XCB
+# ATOM AUX COMPOSITE CURSOR DAMAGE
+# DPMS DRI2 DRI3 EVENT EWMH
+# GLX ICCCM IMAGE KEYSYMS PRESENT
+# RANDR RECORD RENDER RENDERUTIL RES
+# SCREENSAVER SHAPE SHM SYNC UTIL
+# XEVIE XF86DRI XFIXES XINERAMA XINPUT
+# XKB XPRINT XTEST XV XVMC
+#
+# If no components are specified, this module will act as though all components
+# except XINPUT (which is considered unstable) were passed to
+# OPTIONAL_COMPONENTS.
+#
+# This module will define the following variables, independently of the
+# components searched for or found:
+#
+# ``XCB_FOUND``
+# True if (the requestion version of) xcb is available
+# ``XCB_VERSION``
+# Found xcb version
+# ``XCB_TARGETS``
+# A list of all targets imported by this module (note that there may be more
+# than the components that were requested)
+# ``XCB_LIBRARIES``
+# This can be passed to target_link_libraries() instead of the imported
+# targets
+# ``XCB_INCLUDE_DIRS``
+# This should be passed to target_include_directories() if the targets are
+# not used for linking
+# ``XCB_DEFINITIONS``
+# This should be passed to target_compile_options() if the targets are not
+# used for linking
+#
+# For each searched-for components, ``XCB_<component>_FOUND`` will be set to
+# true if the corresponding xcb library was found, and false otherwise. If
+# ``XCB_<component>_FOUND`` is true, the imported target ``XCB::<component>``
+# will be defined. This module will also attempt to determine
+# ``XCB_*_VERSION`` variables for each imported target, although
+# ``XCB_VERSION`` should normally be sufficient.
+#
+# In general we recommend using the imported targets, as they are easier to use
+# and provide more control. Bear in mind, however, that if any target is in the
+# link interface of an exported library, it must be made available by the
+# package config file.
+#
+# Since pre-1.0.0.
+
+#=============================================================================
+# Copyright 2011 Fredrik Höglund <fredrik@kde.org>
+# Copyright 2013 Martin Gräßlin <mgraesslin@kde.org>
+# Copyright 2014-2015 Alex Merry <alex.merry@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)
+
+ecm_find_package_version_check(XCB)
+
+# Note that this list needs to be ordered such that any component
+# appears after its dependencies
+set(XCB_known_components
+ XCB
+ RENDER
+ SHAPE
+ XFIXES
+ SHM
+ ATOM
+ AUX
+ COMPOSITE
+ CURSOR
+ DAMAGE
+ DPMS
+ DRI2
+ DRI3
+ EVENT
+ EWMH
+ GLX
+ ICCCM
+ IMAGE
+ KEYSYMS
+ PRESENT
+ RANDR
+ RECORD
+ RENDERUTIL
+ RES
+ SCREENSAVER
+ SYNC
+ UTIL
+ XEVIE
+ XF86DRI
+ XINERAMA
+ XINPUT
+ XKB
+ XPRINT
+ XTEST
+ XV
+ XVMC
+)
+
+# XINPUT is unstable; do not include it by default
+set(XCB_default_components ${XCB_known_components})
+list(REMOVE_ITEM XCB_default_components "XINPUT")
+
+# default component info: xcb components have fairly predictable
+# header files, library names and pkg-config names
+foreach(_comp ${XCB_known_components})
+ string(TOLOWER "${_comp}" _lc_comp)
+ set(XCB_${_comp}_component_deps XCB)
+ set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}")
+ set(XCB_${_comp}_lib "xcb-${_lc_comp}")
+ set(XCB_${_comp}_header "xcb/${_lc_comp}.h")
+endforeach()
+# exceptions
+set(XCB_XCB_component_deps)
+set(XCB_COMPOSITE_component_deps XCB XFIXES)
+set(XCB_DAMAGE_component_deps XCB XFIXES)
+set(XCB_IMAGE_component_deps XCB SHM)
+set(XCB_RENDERUTIL_component_deps XCB RENDER)
+set(XCB_XFIXES_component_deps XCB RENDER SHAPE)
+set(XCB_XVMC_component_deps XCB XV)
+set(XCB_XV_component_deps XCB SHM)
+set(XCB_XCB_pkg_config "xcb")
+set(XCB_XCB_lib "xcb")
+set(XCB_ATOM_header "xcb/xcb_atom.h")
+set(XCB_ATOM_lib "xcb-util")
+set(XCB_AUX_header "xcb/xcb_aux.h")
+set(XCB_AUX_lib "xcb-util")
+set(XCB_CURSOR_header "xcb/xcb_cursor.h")
+set(XCB_EVENT_header "xcb/xcb_event.h")
+set(XCB_EVENT_lib "xcb-util")
+set(XCB_EWMH_header "xcb/xcb_ewmh.h")
+set(XCB_ICCCM_header "xcb/xcb_icccm.h")
+set(XCB_IMAGE_header "xcb/xcb_image.h")
+set(XCB_KEYSYMS_header "xcb/xcb_keysyms.h")
+set(XCB_PIXEL_header "xcb/xcb_pixel.h")
+set(XCB_RENDERUTIL_header "xcb/xcb_renderutil.h")
+set(XCB_RENDERUTIL_lib "xcb-render-util")
+set(XCB_UTIL_header "xcb/xcb_util.h")
+
+ecm_find_package_parse_components(XCB
+ RESULT_VAR XCB_components
+ KNOWN_COMPONENTS ${XCB_known_components}
+ DEFAULT_COMPONENTS ${XCB_default_components}
+)
+
+list(FIND XCB_components "XINPUT" _XCB_XINPUT_index)
+if (NOT _XCB_XINPUT_index EQUAL -1)
+ message(AUTHOR_WARNING "XINPUT from XCB was requested: this is EXPERIMENTAL and is likely to unavailable on many systems!")
+endif()
+
+ecm_find_package_handle_library_components(XCB
+ COMPONENTS ${XCB_components}
+)
+
+find_package_handle_standard_args(XCB
+ FOUND_VAR
+ XCB_FOUND
+ REQUIRED_VARS
+ XCB_LIBRARIES
+ VERSION_VAR
+ XCB_VERSION
+ HANDLE_COMPONENTS
+)
+
+include(FeatureSummary)
+set_package_properties(XCB PROPERTIES
+ URL "http://xcb.freedesktop.org"
+ DESCRIPTION "X protocol C-language Binding"
+)
diff --git a/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake b/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake
new file mode 100644
index 0000000000..06cc0b66d8
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake
@@ -0,0 +1,173 @@
+#.rst:
+# ECMEnableSanitizers
+# -------------------
+#
+# Enable compiler sanitizer flags.
+#
+# The following sanitizers are supported:
+#
+# - Address Sanitizer
+# - Memory Sanitizer
+# - Thread Sanitizer
+# - Leak Sanitizer
+# - Undefined Behaviour Sanitizer
+#
+# All of them are implemented in Clang, depending on your version, and
+# there is an work in progress in GCC, where some of them are currently
+# implemented.
+#
+# This module will check your current compiler version to see if it
+# supports the sanitizers that you want to enable
+#
+# Usage
+# =====
+#
+# Simply add::
+#
+# include(ECMEnableSanitizers)
+#
+# to your ``CMakeLists.txt``. Note that this module is included in
+# KDECompilerSettings, so projects using that module do not need to also
+# include this one.
+#
+# The sanitizers are not enabled by default. Instead, you must set
+# ``ECM_ENABLE_SANITIZERS`` (either in your ``CMakeLists.txt`` or on the
+# command line) to a semicolon-separated list of sanitizers you wish to enable.
+# The options are:
+#
+# - address
+# - memory
+# - thread
+# - leak
+# - undefined
+#
+# The sanitizers "address", "memory" and "thread" are mutually exclusive. You
+# cannot enable two of them in the same build.
+#
+# "leak" requires the "address" sanitizer.
+#
+# .. note::
+#
+# To reduce the overhead induced by the instrumentation of the sanitizers, it
+# is advised to enable compiler optimizations (``-O1`` or higher).
+#
+# Example
+# =======
+#
+# This is an example of usage::
+#
+# mkdir build
+# cd build
+# cmake -DECM_ENABLE_SANITIZERS='address;leak;undefined' ..
+#
+# .. note::
+#
+# Most of the sanitizers will require Clang. To enable it, use::
+#
+# -DCMAKE_CXX_COMPILER=clang++
+#
+# Since 1.3.0.
+
+#=============================================================================
+# Copyright 2014 Mathieu Tarral <mathieu.tarral@gmail.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# MACRO check_compiler_version
+#-----------------------------
+macro (check_compiler_version gcc_required_version clang_required_version)
+ if (
+ (
+ CMAKE_CXX_COMPILER_ID MATCHES "GNU"
+ AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_required_version}
+ )
+ OR
+ (
+ CMAKE_CXX_COMPILER_ID MATCHES "Clang"
+ AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${clang_required_version}
+ )
+ )
+ # error !
+ message(FATAL_ERROR "You ask to enable the sanitizer ${CUR_SANITIZER},
+ but your compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}
+ does not support it !
+ You should use at least GCC ${gcc_required_version} or Clang ${clang_required_version}
+ (99.99 means not implemented yet)")
+ endif ()
+endmacro ()
+
+# MACRO check_compiler_support
+#------------------------------
+macro (enable_sanitizer_flags sanitize_option)
+ if (${sanitize_option} MATCHES "address")
+ check_compiler_version("4.8" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+ set(XSAN_LINKER_FLAGS "asan")
+ elseif (${sanitize_option} MATCHES "thread")
+ check_compiler_version("4.8" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
+ set(XSAN_LINKER_FLAGS "tsan")
+ elseif (${sanitize_option} MATCHES "memory")
+ check_compiler_version("99.99" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=memory")
+ elseif (${sanitize_option} MATCHES "leak")
+ check_compiler_version("4.9" "3.4")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=leak")
+ set(XSAN_LINKER_FLAGS "lsan")
+ elseif (${sanitize_option} MATCHES "undefined")
+ check_compiler_version("4.9" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+ else ()
+ message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.")
+ endif ()
+endmacro ()
+
+if (ECM_ENABLE_SANITIZERS)
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ # for each element of the ECM_ENABLE_SANITIZERS list
+ foreach ( CUR_SANITIZER ${ECM_ENABLE_SANITIZERS} )
+ # lowercase filter
+ string(TOLOWER ${CUR_SANITIZER} CUR_SANITIZER)
+ # check option and enable appropriate flags
+ enable_sanitizer_flags ( ${CUR_SANITIZER} )
+ # TODO: GCC will not link pthread library if enabled ASan
+ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XSAN_COMPILE_FLAGS}" )
+ endif()
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}" )
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ link_libraries(${XSAN_LINKER_FLAGS})
+ endif()
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
+ string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
+ endif ()
+ endforeach()
+ else()
+ message(STATUS "Tried to enable sanitizers (-DECM_ENABLE_SANITIZERS=${ECM_ENABLE_SANITIZERS}), \
+but compiler (${CMAKE_CXX_COMPILER_ID}) does not have sanitizer support")
+ endif()
+endif()
diff --git a/cmake/3rdparty/extra-cmake-modules/modules/ECMFindModuleHelpers.cmake b/cmake/3rdparty/extra-cmake-modules/modules/ECMFindModuleHelpers.cmake
new file mode 100644
index 0000000000..f2e32f959e
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/modules/ECMFindModuleHelpers.cmake
@@ -0,0 +1,297 @@
+#.rst:
+# ECMFindModuleHelpers
+# --------------------
+#
+# Helper macros for find modules: ecm_find_package_version_check(),
+# ecm_find_package_parse_components() and
+# ecm_find_package_handle_library_components().
+#
+# ::
+#
+# ecm_find_package_version_check(<name>)
+#
+# Prints warnings if the CMake version or the project's required CMake version
+# is older than that required by extra-cmake-modules.
+#
+# ::
+#
+# ecm_find_package_parse_components(<name>
+# RESULT_VAR <variable>
+# KNOWN_COMPONENTS <component1> [<component2> [...]]
+# [SKIP_DEPENDENCY_HANDLING])
+#
+# This macro will populate <variable> with a list of components found in
+# <name>_FIND_COMPONENTS, after checking that all those components are in the
+# list of KNOWN_COMPONENTS; if there are any unknown components, it will print
+# an error or warning (depending on the value of <name>_FIND_REQUIRED) and call
+# return().
+#
+# The order of components in <variable> is guaranteed to match the order they
+# are listed in the KNOWN_COMPONENTS argument.
+#
+# If SKIP_DEPENDENCY_HANDLING is not set, for each component the variable
+# <name>_<component>_component_deps will be checked for dependent components.
+# If <component> is listed in <name>_FIND_COMPONENTS, then all its (transitive)
+# dependencies will also be added to <variable>.
+#
+# ::
+#
+# ecm_find_package_handle_library_components(<name>
+# COMPONENTS <component> [<component> [...]]
+# [SKIP_DEPENDENCY_HANDLING])
+# [SKIP_PKG_CONFIG])
+#
+# Creates an imported library target for each component. The operation of this
+# macro depends on the presence of a number of CMake variables.
+#
+# The <name>_<component>_lib variable should contain the name of this library,
+# and <name>_<component>_header variable should contain the name of a header
+# file associated with it (whatever relative path is normally passed to
+# '#include'). <name>_<component>_header_subdir variable can be used to specify
+# which subdirectory of the include path the headers will be found in.
+# ecm_find_package_components() will then search for the library
+# and include directory (creating appropriate cache variables) and create an
+# imported library target named <name>::<component>.
+#
+# Additional variables can be used to provide additional information:
+#
+# If SKIP_PKG_CONFIG, the <name>_<component>_pkg_config variable is set, and
+# pkg-config is found, the pkg-config module given by
+# <name>_<component>_pkg_config will be searched for and used to help locate the
+# library and header file. It will also be used to set
+# <name>_<component>_VERSION.
+#
+# Note that if version information is found via pkg-config,
+# <name>_<component>_FIND_VERSION can be set to require a particular version
+# for each component.
+#
+# If SKIP_DEPENDENCY_HANDLING is not set, the INTERFACE_LINK_LIBRARIES property
+# of the imported target for <component> will be set to contain the imported
+# targets for the components listed in <name>_<component>_component_deps.
+# <component>_FOUND will also be set to false if any of the compoments in
+# <name>_<component>_component_deps are not found. This requires the components
+# in <name>_<component>_component_deps to be listed before <component> in the
+# COMPONENTS argument.
+#
+# The following variables will be set:
+#
+# ``<name>_TARGETS``
+# the imported targets
+# ``<name>_LIBRARIES``
+# the found libraries
+# ``<name>_INCLUDE_DIRS``
+# the combined required include directories for the components
+# ``<name>_DEFINITIONS``
+# the "other" CFLAGS provided by pkg-config, if any
+# ``<name>_VERSION``
+# the value of ``<name>_<component>_VERSION`` for the first component that
+# has this variable set (note that components are searched for in the order
+# they are passed to the macro), although if it is already set, it will not
+# be altered
+#
+# Note that these variables are never cleared, so if
+# ecm_find_package_handle_library_components() is called multiple times with
+# different components (typically because of multiple find_package() calls) then
+# ``<name>_TARGETS``, for example, will contain all the targets found in any
+# call (although no duplicates).
+#
+# Since pre-1.0.0.
+
+#=============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include(CMakeParseArguments)
+
+macro(ecm_find_package_version_check module_name)
+ if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "CMake 2.8.12 is required by Find${module_name}.cmake")
+ endif()
+ if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Find${module_name}.cmake")
+ endif()
+endmacro()
+
+macro(ecm_find_package_parse_components module_name)
+ set(ecm_fppc_options SKIP_DEPENDENCY_HANDLING)
+ set(ecm_fppc_oneValueArgs RESULT_VAR)
+ set(ecm_fppc_multiValueArgs KNOWN_COMPONENTS DEFAULT_COMPONENTS)
+ cmake_parse_arguments(ECM_FPPC "${ecm_fppc_options}" "${ecm_fppc_oneValueArgs}" "${ecm_fppc_multiValueArgs}" ${ARGN})
+
+ if(ECM_FPPC_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unexpected arguments to ecm_find_package_parse_components: ${ECM_FPPC_UNPARSED_ARGUMENTS}")
+ endif()
+ if(NOT ECM_FPPC_RESULT_VAR)
+ message(FATAL_ERROR "Missing RESULT_VAR argument to ecm_find_package_parse_components")
+ endif()
+ if(NOT ECM_FPPC_KNOWN_COMPONENTS)
+ message(FATAL_ERROR "Missing KNOWN_COMPONENTS argument to ecm_find_package_parse_components")
+ endif()
+ if(NOT ECM_FPPC_DEFAULT_COMPONENTS)
+ set(ECM_FPPC_DEFAULT_COMPONENTS ${ECM_FPPC_KNOWN_COMPONENTS})
+ endif()
+
+ if(${module_name}_FIND_COMPONENTS)
+ set(ecm_fppc_requestedComps ${${module_name}_FIND_COMPONENTS})
+
+ if(NOT ECM_FPPC_SKIP_DEPENDENCY_HANDLING)
+ # Make sure deps are included
+ foreach(ecm_fppc_comp ${ecm_fppc_requestedComps})
+ foreach(ecm_fppc_dep_comp ${${module_name}_${ecm_fppc_comp}_component_deps})
+ list(FIND ecm_fppc_requestedComps "${ecm_fppc_dep_comp}" ecm_fppc_index)
+ if("${ecm_fppc_index}" STREQUAL "-1")
+ if(NOT ${module_name}_FIND_QUIETLY)
+ message(STATUS "${module_name}: ${ecm_fppc_comp} requires ${${module_name}_${ecm_fppc_comp}_component_deps}")
+ endif()
+ list(APPEND ecm_fppc_requestedComps "${ecm_fppc_dep_comp}")
+ endif()
+ endforeach()
+ endforeach()
+ else()
+ message(STATUS "Skipping dependency handling for ${module_name}")
+ endif()
+ list(REMOVE_DUPLICATES ecm_fppc_requestedComps)
+
+ # This makes sure components are listed in the same order as
+ # KNOWN_COMPONENTS (potentially important for inter-dependencies)
+ set(${ECM_FPPC_RESULT_VAR})
+ foreach(ecm_fppc_comp ${ECM_FPPC_KNOWN_COMPONENTS})
+ list(FIND ecm_fppc_requestedComps "${ecm_fppc_comp}" ecm_fppc_index)
+ if(NOT "${ecm_fppc_index}" STREQUAL "-1")
+ list(APPEND ${ECM_FPPC_RESULT_VAR} "${ecm_fppc_comp}")
+ list(REMOVE_AT ecm_fppc_requestedComps ${ecm_fppc_index})
+ endif()
+ endforeach()
+ # if there are any left, they are unknown components
+ if(ecm_fppc_requestedComps)
+ set(ecm_fppc_msgType STATUS)
+ if(${module_name}_FIND_REQUIRED)
+ set(ecm_fppc_msgType FATAL_ERROR)
+ endif()
+ if(NOT ${module_name}_FIND_QUIETLY)
+ message(${ecm_fppc_msgType} "${module_name}: requested unknown components ${ecm_fppc_requestedComps}")
+ endif()
+ return()
+ endif()
+ else()
+ set(${ECM_FPPC_RESULT_VAR} ${ECM_FPPC_DEFAULT_COMPONENTS})
+ endif()
+endmacro()
+
+macro(ecm_find_package_handle_library_components module_name)
+ set(ecm_fpwc_options SKIP_PKG_CONFIG SKIP_DEPENDENCY_HANDLING)
+ set(ecm_fpwc_oneValueArgs)
+ set(ecm_fpwc_multiValueArgs COMPONENTS)
+ cmake_parse_arguments(ECM_FPWC "${ecm_fpwc_options}" "${ecm_fpwc_oneValueArgs}" "${ecm_fpwc_multiValueArgs}" ${ARGN})
+
+ if(ECM_FPWC_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unexpected arguments to ecm_find_package_handle_components: ${ECM_FPWC_UNPARSED_ARGUMENTS}")
+ endif()
+ if(NOT ECM_FPWC_COMPONENTS)
+ message(FATAL_ERROR "Missing COMPONENTS argument to ecm_find_package_handle_components")
+ endif()
+
+ include(FindPackageHandleStandardArgs)
+ find_package(PkgConfig)
+ foreach(ecm_fpwc_comp ${ECM_FPWC_COMPONENTS})
+ set(ecm_fpwc_dep_vars)
+ set(ecm_fpwc_dep_targets)
+ if(NOT SKIP_DEPENDENCY_HANDLING)
+ foreach(ecm_fpwc_dep ${${module_name}_${ecm_fpwc_comp}_component_deps})
+ list(APPEND ecm_fpwc_dep_vars "${module_name}_${ecm_fpwc_dep}_FOUND")
+ list(APPEND ecm_fpwc_dep_targets "${module_name}::${ecm_fpwc_dep}")
+ endforeach()
+ endif()
+
+ if(NOT ECM_FPWC_SKIP_PKG_CONFIG AND ${module_name}_${ecm_fpwc_comp}_pkg_config)
+ pkg_check_modules(PKG_${module_name}_${ecm_fpwc_comp} QUIET
+ ${${module_name}_${ecm_fpwc_comp}_pkg_config})
+ endif()
+
+ find_path(${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR
+ NAMES ${${module_name}_${ecm_fpwc_comp}_header}
+ HINTS ${PKG_${module_name}_${ecm_fpwc_comp}_INCLUDE_DIRS}
+ PATH_SUFFIXES ${${module_name}_${ecm_fpwc_comp}_header_subdir}
+ )
+ find_library(${module_name}_${ecm_fpwc_comp}_LIBRARY
+ NAMES ${${module_name}_${ecm_fpwc_comp}_lib}
+ HINTS ${PKG_${module_name}_${ecm_fpwc_comp}_LIBRARY_DIRS}
+ )
+
+ set(${module_name}_${ecm_fpwc_comp}_VERSION "${PKG_${module_name}_${ecm_fpwc_comp}_VERSION}")
+ if(NOT ${module_name}_VERSION)
+ set(${module_name}_VERSION ${${module_name}_${ecm_fpwc_comp}_VERSION})
+ endif()
+
+ find_package_handle_standard_args(${module_name}_${ecm_fpwc_comp}
+ FOUND_VAR
+ ${module_name}_${ecm_fpwc_comp}_FOUND
+ REQUIRED_VARS
+ ${module_name}_${ecm_fpwc_comp}_LIBRARY
+ ${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR
+ ${ecm_fpwc_dep_vars}
+ VERSION_VAR
+ ${module_name}_${ecm_fpwc_comp}_VERSION
+ )
+
+ mark_as_advanced(
+ ${module_name}_${ecm_fpwc_comp}_LIBRARY
+ ${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR
+ )
+
+ if(${module_name}_${ecm_fpwc_comp}_FOUND)
+ list(APPEND ${module_name}_LIBRARIES
+ "${${module_name}_${ecm_fpwc_comp}_LIBRARY}")
+ list(APPEND ${module_name}_INCLUDE_DIRS
+ "${${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR}")
+ set(${module_name}_DEFINITIONS
+ ${${module_name}_DEFINITIONS}
+ ${PKG_${module_name}_${ecm_fpwc_comp}_DEFINITIONS})
+ if(NOT TARGET ${module_name}::${ecm_fpwc_comp})
+ add_library(${module_name}::${ecm_fpwc_comp} UNKNOWN IMPORTED)
+ set_target_properties(${module_name}::${ecm_fpwc_comp} PROPERTIES
+ IMPORTED_LOCATION "${${module_name}_${ecm_fpwc_comp}_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PKG_${module_name}_${ecm_fpwc_comp}_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${${module_name}_${ecm_fpwc_comp}_INCLUDE_DIR}"
+ INTERFACE_LINK_LIBRARIES "${ecm_fpwc_dep_targets}"
+ )
+ endif()
+ list(APPEND ${module_name}_TARGETS
+ "${module_name}::${ecm_fpwc_comp}")
+ endif()
+ endforeach()
+ if(${module_name}_LIBRARIES)
+ list(REMOVE_DUPLICATES ${module_name}_LIBRARIES)
+ endif()
+ if(${module_name}_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES ${module_name}_INCLUDE_DIRS)
+ endif()
+ if(${module_name}_DEFINITIONS)
+ list(REMOVE_DUPLICATES ${module_name}_DEFINITIONS)
+ endif()
+ if(${module_name}_TARGETS)
+ list(REMOVE_DUPLICATES ${module_name}_TARGETS)
+ endif()
+endmacro()
diff --git a/cmake/3rdparty/extra-cmake-modules/qt_attribution.json b/cmake/3rdparty/extra-cmake-modules/qt_attribution.json
new file mode 100644
index 0000000000..cebebf82eb
--- /dev/null
+++ b/cmake/3rdparty/extra-cmake-modules/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "extra-cmake-modules",
+ "Name": "extra-cmake-modules",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used as part of the build system.",
+
+ "Description": "Additional CMake modules.",
+ "Homepage": "https://api.kde.org/ecm/",
+ "Version": "5.50.0",
+
+ "License": "BSD-3-Clause",
+ "LicenseId": "BSD 3-Clause License",
+ "LicenseFile": "COPYING-CMAKE-SCRIPTS",
+ "Copyright": "Copyright © 2011-2018 The KDE community"
+}
diff --git a/cmake/3rdparty/kwin/COPYING-CMAKE-SCRIPTS b/cmake/3rdparty/kwin/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000000..4b417765f3
--- /dev/null
+++ b/cmake/3rdparty/kwin/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake/3rdparty/kwin/FindFontconfig.cmake b/cmake/3rdparty/kwin/FindFontconfig.cmake
new file mode 100644
index 0000000000..d95e46b484
--- /dev/null
+++ b/cmake/3rdparty/kwin/FindFontconfig.cmake
@@ -0,0 +1,50 @@
+# - Try to find the Fontconfig
+# Once done this will define
+#
+# FONTCONFIG_FOUND - system has Fontconfig
+# FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers
+# FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
+# FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
+
+# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+ # in cache already
+ set(FONTCONFIG_FOUND TRUE)
+
+else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+ if (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PC_FONTCONFIG QUIET fontconfig)
+
+ set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER})
+ endif (NOT WIN32)
+
+ find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
+ PATHS
+ ${PC_FONTCONFIG_INCLUDEDIR}
+ ${PC_FONTCONFIG_INCLUDE_DIRS}
+ /usr/X11/include
+ )
+
+ find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
+ PATHS
+ ${PC_FONTCONFIG_LIBDIR}
+ ${PC_FONTCONFIG_LIBRARY_DIRS}
+ )
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR )
+
+ mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
+
+endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
diff --git a/cmake/3rdparty/kwin/FindLibdrm.cmake b/cmake/3rdparty/kwin/FindLibdrm.cmake
new file mode 100644
index 0000000000..9936e07eee
--- /dev/null
+++ b/cmake/3rdparty/kwin/FindLibdrm.cmake
@@ -0,0 +1,126 @@
+#.rst:
+# FindLibdrm
+# -------
+#
+# Try to find libdrm on a Unix system.
+#
+# This will define the following variables:
+#
+# ``Libdrm_FOUND``
+# True if (the requested version of) libdrm is available
+# ``Libdrm_VERSION``
+# The version of libdrm
+# ``Libdrm_LIBRARIES``
+# This can be passed to target_link_libraries() instead of the ``Libdrm::Libdrm``
+# target
+# ``Libdrm_INCLUDE_DIRS``
+# This should be passed to target_include_directories() if the target is not
+# used for linking
+# ``Libdrm_DEFINITIONS``
+# This should be passed to target_compile_options() if the target is not
+# used for linking
+#
+# If ``Libdrm_FOUND`` is TRUE, it will also define the following imported target:
+#
+# ``Libdrm::Libdrm``
+# The libdrm library
+#
+# In general we recommend using the imported target, as it is easier to use.
+# Bear in mind, however, that if the target is in the link interface of an
+# exported library, it must be made available by the package config file.
+
+#=============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org>
+# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "CMake 2.8.12 is required by FindLibdrm.cmake")
+endif()
+if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindLibdrm.cmake")
+endif()
+
+if(NOT WIN32)
+ # Use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PKG_Libdrm QUIET libdrm)
+
+ set(Libdrm_DEFINITIONS ${PKG_Libdrm_CFLAGS_OTHER})
+ set(Libdrm_VERSION ${PKG_Libdrm_VERSION})
+
+ find_path(Libdrm_INCLUDE_DIR
+ NAMES
+ xf86drm.h
+ HINTS
+ ${PKG_Libdrm_INCLUDE_DIRS}
+ )
+ find_library(Libdrm_LIBRARY
+ NAMES
+ drm
+ HINTS
+ ${PKG_Libdrm_LIBRARY_DIRS}
+ )
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Libdrm
+ FOUND_VAR
+ Libdrm_FOUND
+ REQUIRED_VARS
+ Libdrm_LIBRARY
+ Libdrm_INCLUDE_DIR
+ VERSION_VAR
+ Libdrm_VERSION
+ )
+
+ if(Libdrm_FOUND AND NOT TARGET Libdrm::Libdrm)
+ add_library(Libdrm::Libdrm UNKNOWN IMPORTED)
+ set_target_properties(Libdrm::Libdrm PROPERTIES
+ IMPORTED_LOCATION "${Libdrm_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${Libdrm_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/libdrm"
+ )
+ endif()
+
+ mark_as_advanced(Libdrm_LIBRARY Libdrm_INCLUDE_DIR)
+
+ # compatibility variables
+ set(Libdrm_LIBRARIES ${Libdrm_LIBRARY})
+ set(Libdrm_INCLUDE_DIRS ${Libdrm_INCLUDE_DIR} "${Libdrm_INCLUDE_DIR}/libdrm")
+ set(Libdrm_VERSION_STRING ${Libdrm_VERSION})
+
+else()
+ message(STATUS "FindLibdrm.cmake cannot find libdrm on Windows systems.")
+ set(Libdrm_FOUND FALSE)
+endif()
+
+include(FeatureSummary)
+set_package_properties(Libdrm PROPERTIES
+ URL "https://wiki.freedesktop.org/dri/"
+ DESCRIPTION "Userspace interface to kernel DRM services."
+)
diff --git a/cmake/3rdparty/kwin/FindLibinput.cmake b/cmake/3rdparty/kwin/FindLibinput.cmake
new file mode 100644
index 0000000000..b856e0bbcb
--- /dev/null
+++ b/cmake/3rdparty/kwin/FindLibinput.cmake
@@ -0,0 +1,125 @@
+#.rst:
+# FindLibinput
+# -------
+#
+# Try to find libinput on a Unix system.
+#
+# This will define the following variables:
+#
+# ``Libinput_FOUND``
+# True if (the requested version of) libinput is available
+# ``Libinput_VERSION``
+# The version of libinput
+# ``Libinput_LIBRARIES``
+# This can be passed to target_link_libraries() instead of the ``Libinput::Libinput``
+# target
+# ``Libinput_INCLUDE_DIRS``
+# This should be passed to target_include_directories() if the target is not
+# used for linking
+# ``Libinput_DEFINITIONS``
+# This should be passed to target_compile_options() if the target is not
+# used for linking
+#
+# If ``Libinput_FOUND`` is TRUE, it will also define the following imported target:
+#
+# ``Libinput::Libinput``
+# The libinput library
+#
+# In general we recommend using the imported target, as it is easier to use.
+# Bear in mind, however, that if the target is in the link interface of an
+# exported library, it must be made available by the package config file.
+
+#=============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org>
+# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "CMake 2.8.12 is required by FindLibinput.cmake")
+endif()
+if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindLibinput.cmake")
+endif()
+
+if(NOT WIN32)
+ # Use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PKG_Libinput QUIET libinput)
+
+ set(Libinput_DEFINITIONS ${PKG_Libinput_CFLAGS_OTHER})
+ set(Libinput_VERSION ${PKG_Libinput_VERSION})
+
+ find_path(Libinput_INCLUDE_DIR
+ NAMES
+ libinput.h
+ HINTS
+ ${PKG_Libinput_INCLUDE_DIRS}
+ )
+ find_library(Libinput_LIBRARY
+ NAMES
+ input
+ HINTS
+ ${PKG_Libinput_LIBRARY_DIRS}
+ )
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Libinput
+ FOUND_VAR
+ Libinput_FOUND
+ REQUIRED_VARS
+ Libinput_LIBRARY
+ Libinput_INCLUDE_DIR
+ VERSION_VAR
+ Libinput_VERSION
+ )
+
+ if(Libinput_FOUND AND NOT TARGET Libinput::Libinput)
+ add_library(Libinput::Libinput UNKNOWN IMPORTED)
+ set_target_properties(Libinput::Libinput PROPERTIES
+ IMPORTED_LOCATION "${Libinput_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${Libinput_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Libinput_INCLUDE_DIR}"
+ )
+ endif()
+
+ mark_as_advanced(Libinput_LIBRARY Libinput_INCLUDE_DIR)
+
+ # compatibility variables
+ set(Libinput_LIBRARIES ${Libinput_LIBRARY})
+ set(Libinput_INCLUDE_DIRS ${Libinput_INCLUDE_DIR})
+ set(Libinput_VERSION_STRING ${Libinput_VERSION})
+
+else()
+ message(STATUS "FindLibinput.cmake cannot find libinput on Windows systems.")
+ set(Libinput_FOUND FALSE)
+endif()
+
+include(FeatureSummary)
+set_package_properties(Libinput PROPERTIES
+ URL "http://www.freedesktop.org/wiki/Software/libinput/"
+ DESCRIPTION "Library to handle input devices in Wayland compositors and to provide a generic X.Org input driver."
+)
diff --git a/cmake/3rdparty/kwin/FindXKB.cmake b/cmake/3rdparty/kwin/FindXKB.cmake
new file mode 100644
index 0000000000..0d599df0fd
--- /dev/null
+++ b/cmake/3rdparty/kwin/FindXKB.cmake
@@ -0,0 +1,101 @@
+# Try to find xkbcommon on a Unix system
+#
+# This will define:
+#
+# XKB_FOUND - True if XKB is available
+# XKB_LIBRARIES - Link these to use XKB
+# XKB_INCLUDE_DIRS - Include directory for XKB
+# XKB_DEFINITIONS - Compiler flags for using XKB
+#
+# Additionally, the following imported targets will be defined:
+#
+# XKB::XKB
+#
+# Copyright (c) 2014 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "CMake 2.8.12 is required by FindXKB.cmake")
+endif()
+if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindXKB.cmake")
+endif()
+
+if(NOT WIN32)
+ # Use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PKG_XKB QUIET xkbcommon)
+
+ set(XKB_DEFINITIONS ${PKG_XKB_CFLAGS_OTHER})
+
+ find_path(XKB_INCLUDE_DIR
+ NAMES
+ xkbcommon/xkbcommon.h
+ HINTS
+ ${PKG_XKB_INCLUDE_DIRS}
+ )
+ find_library(XKB_LIBRARY
+ NAMES
+ xkbcommon
+ HINTS
+ ${PKG_XKB_LIBRARY_DIRS}
+ )
+
+ set(XKB_LIBRARIES ${XKB_LIBRARY})
+ set(XKB_INCLUDE_DIRS ${XKB_INCLUDE_DIR})
+ set(XKB_VERSION ${PKG_XKB_VERSION})
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(XKB
+ FOUND_VAR
+ XKB_FOUND
+ REQUIRED_VARS
+ XKB_LIBRARY
+ XKB_INCLUDE_DIR
+ VERSION_VAR
+ XKB_VERSION
+ )
+
+ if(XKB_FOUND AND NOT TARGET XKB::XKB)
+ add_library(XKB::XKB UNKNOWN IMPORTED)
+ set_target_properties(XKB::XKB PROPERTIES
+ IMPORTED_LOCATION "${XKB_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${XKB_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${XKB_INCLUDE_DIR}"
+ )
+ endif()
+
+else()
+ message(STATUS "FindXKB.cmake cannot find XKB on Windows systems.")
+ set(XKB_FOUND FALSE)
+endif()
+
+include(FeatureSummary)
+set_package_properties(XKB PROPERTIES
+ URL "http://xkbcommon.org"
+ DESCRIPTION "XKB API common to servers and clients."
+)
diff --git a/cmake/3rdparty/kwin/Findgbm.cmake b/cmake/3rdparty/kwin/Findgbm.cmake
new file mode 100644
index 0000000000..6dfc895daa
--- /dev/null
+++ b/cmake/3rdparty/kwin/Findgbm.cmake
@@ -0,0 +1,125 @@
+#.rst:
+# Findgbm
+# -------
+#
+# Try to find gbm on a Unix system.
+#
+# This will define the following variables:
+#
+# ``gbm_FOUND``
+# True if (the requested version of) gbm is available
+# ``gbm_VERSION``
+# The version of gbm
+# ``gbm_LIBRARIES``
+# This can be passed to target_link_libraries() instead of the ``gbm::gbm``
+# target
+# ``gbm_INCLUDE_DIRS``
+# This should be passed to target_include_directories() if the target is not
+# used for linking
+# ``gbm_DEFINITIONS``
+# This should be passed to target_compile_options() if the target is not
+# used for linking
+#
+# If ``gbm_FOUND`` is TRUE, it will also define the following imported target:
+#
+# ``gbm::gbm``
+# The gbm library
+#
+# In general we recommend using the imported target, as it is easier to use.
+# Bear in mind, however, that if the target is in the link interface of an
+# exported library, it must be made available by the package config file.
+
+#=============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org>
+# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake")
+endif()
+if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake")
+endif()
+
+if(NOT WIN32)
+ # Use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PKG_gbm QUIET gbm)
+
+ set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER})
+ set(gbm_VERSION ${PKG_gbm_VERSION})
+
+ find_path(gbm_INCLUDE_DIR
+ NAMES
+ gbm.h
+ HINTS
+ ${PKG_gbm_INCLUDE_DIRS}
+ )
+ find_library(gbm_LIBRARY
+ NAMES
+ gbm
+ HINTS
+ ${PKG_gbm_LIBRARY_DIRS}
+ )
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(gbm
+ FOUND_VAR
+ gbm_FOUND
+ REQUIRED_VARS
+ gbm_LIBRARY
+ gbm_INCLUDE_DIR
+ VERSION_VAR
+ gbm_VERSION
+ )
+
+ if(gbm_FOUND AND NOT TARGET gbm::gbm)
+ add_library(gbm::gbm UNKNOWN IMPORTED)
+ set_target_properties(gbm::gbm PROPERTIES
+ IMPORTED_LOCATION "${gbm_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}"
+ )
+ endif()
+
+ mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR)
+
+ # compatibility variables
+ set(gbm_LIBRARIES ${gbm_LIBRARY})
+ set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR})
+ set(gbm_VERSION_STRING ${gbm_VERSION})
+
+else()
+ message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.")
+ set(gbm_FOUND FALSE)
+endif()
+
+include(FeatureSummary)
+set_package_properties(gbm PROPERTIES
+ URL "http://www.mesa3d.org"
+ DESCRIPTION "Mesa gbm library."
+)
diff --git a/cmake/3rdparty/kwin/qt_attribution.json b/cmake/3rdparty/kwin/qt_attribution.json
new file mode 100644
index 0000000000..5c22641132
--- /dev/null
+++ b/cmake/3rdparty/kwin/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "kwin",
+ "Name": "KWin",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used as part of the build system.",
+
+ "Description": "Additional CMake modules for graphics system dependencies.",
+ "Homepage": "https://www.kde.org/",
+ "Version": "5.13.4",
+
+ "License": "BSD-3-Clause",
+ "LicenseId": "BSD 3-Clause License",
+ "LicenseFile": "COPYING-CMAKE-SCRIPTS",
+ "Copyright": "Copyright 2014 Alex Merry <alex.merry@kde.org>
+Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>,
+Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>"
+}
diff --git a/cmake/FindAtomic.cmake b/cmake/FindAtomic.cmake
new file mode 100644
index 0000000000..6676378686
--- /dev/null
+++ b/cmake/FindAtomic.cmake
@@ -0,0 +1,37 @@
+include(CheckCXXSourceCompiles)
+
+set (atomic_test_sources "#include <atomic>
+#include <cstdint>
+
+void test(volatile std::atomic<std::int64_t> &a)
+{
+ std::int64_t v = a.load(std::memory_order_acquire);
+ while (!a.compare_exchange_strong(v, v + 1,
+ std::memory_order_acq_rel,
+ std::memory_order_acquire)) {
+ v = a.exchange(v - 1);
+ }
+ a.store(v + 1, std::memory_order_release);
+}
+
+int main(int, char **)
+{
+ void *ptr = (void*)0xffffffc0; // any random pointer
+ test(*reinterpret_cast<std::atomic<std::int64_t> *>(ptr));
+ return 0;
+}")
+
+check_cxx_source_compiles("${atomic_test_sources}" HAVE_STDATOMIC)
+if(NOT HAVE_STDATOMIC)
+ set(_req_libraries "${CMAKE_REQUIRE_LIBRARIES}")
+ set(CMAKE_REQUIRE_LIBRARIES "atomic")
+ check_cxx_source_compiles("${atomic_test_sources}" HAVE_STDATOMIC_WITH_LIB)
+ set(CMAKE_REQUIRE_LIBRARIES "${_req_libraries}")
+endif()
+
+add_library(Atomic INTERFACE)
+if(HAVE_STDATOMIC_WITH_LIB)
+ target_link_libraries(Atomic INTERFACE atomic)
+endif()
+
+set(Atomic_FOUND 1)
diff --git a/cmake/FindGLib.cmake b/cmake/FindGLib.cmake
new file mode 100644
index 0000000000..461564122a
--- /dev/null
+++ b/cmake/FindGLib.cmake
@@ -0,0 +1,3 @@
+find_package(PkgConfig)
+
+pkg_check_modules(GLib glib-2.0 IMPORTED_TARGET)
diff --git a/cmake/FindLibsystemd.cmake b/cmake/FindLibsystemd.cmake
new file mode 100644
index 0000000000..9c0082fd39
--- /dev/null
+++ b/cmake/FindLibsystemd.cmake
@@ -0,0 +1,3 @@
+find_package(PkgConfig)
+
+pkg_check_modules(Libsystemd systemd IMPORTED_TARGET)
diff --git a/cmake/FindLibudev.cmake b/cmake/FindLibudev.cmake
new file mode 100644
index 0000000000..a36c81ff4a
--- /dev/null
+++ b/cmake/FindLibudev.cmake
@@ -0,0 +1,3 @@
+find_package(PkgConfig)
+
+pkg_check_modules(Libudev udev IMPORTED_TARGET)
diff --git a/cmake/FindPCRE2.cmake b/cmake/FindPCRE2.cmake
new file mode 100644
index 0000000000..7e45c963d7
--- /dev/null
+++ b/cmake/FindPCRE2.cmake
@@ -0,0 +1,13 @@
+
+find_library(PCRE2_LIBRARIES NAMES pcre2-16)
+find_path(PCRE2_INCLUDE_DIRS pcre2.h)
+
+if (PCRE2_LIBRARIES STREQUAL "PCRE2_LIBRARIES-NOTFOUND" OR PCRE2_INCLUDE_DIRS STREQUAL "PCRE2_INCLUDE_DIRS-NOTFOUND")
+ set(PCRE2_FOUND 0)
+else()
+ add_library(PCRE2 INTERFACE)
+ target_link_libraries(PCRE2 INTERFACE ${PCRE2_LIBRARIES})
+ target_include_directories(PCRE2 INTERFACE ${PCRE2_INCLUDE_DIRS})
+ set(PCRE2_FOUND 1)
+endif()
+
diff --git a/cmake/FindWrapDoubleConversion.cmake b/cmake/FindWrapDoubleConversion.cmake
new file mode 100644
index 0000000000..c93525af23
--- /dev/null
+++ b/cmake/FindWrapDoubleConversion.cmake
@@ -0,0 +1,36 @@
+include(CheckCXXSourceCompiles)
+
+check_cxx_source_compiles("
+#include <stdio.h>
+#include <locale.h>
+
+int main(int argc, char *argv[]) {
+ _locale_t invalidLocale = NULL;
+ double a = 3.14;
+ const char *format = \"invalid format\";
+ _sscanf_l(argv[0], invalidLocale, format, &a, &argc);
+ _snprintf_l(argv[0], 1, invalidLocale, format, a);
+}" HAVE__SPRINTF_L)
+
+check_cxx_source_compiles("
+#include <stdio.h>
+#include <xlocale.h>
+
+int main(int argc, char *argv[]) {
+ locale_t invalidLocale = NULL;
+ double a = 3.14;
+ const char *format = \"invalid format\";
+ snprintf_l(argv[0], 1, invalidLocale, format, a);
+ sscanf_l(argv[0], invalidLocale, format, &a, &argc);
+ return 0;
+}" HAVE_SPRINTF_L)
+
+add_library(WrapDoubleConversion INTERFACE)
+if (NOT HAVE__SPRINTF_L AND NOT HAVE_SPRINTF_L)
+ find_package(double-conversion)
+ set_package_properties(double-conversion PROPERTIES TYPE REQUIRED)
+ target_link_libraries(WrapDoubleConversion INTERFACE double-conversion::double-conversion)
+endif()
+
+set(WrapDoubleConversion_FOUND 1)
+
diff --git a/cmake/Finddouble-conversion.cmake b/cmake/Finddouble-conversion.cmake
new file mode 100644
index 0000000000..77785696b9
--- /dev/null
+++ b/cmake/Finddouble-conversion.cmake
@@ -0,0 +1,30 @@
+# Fallback find module for double-conversion
+# if double-conversion is built with CMake it'll install a config module, which we prefer
+# if it's built with Scons (their default), we search ourselves
+
+find_package(double-conversion CONFIG)
+if (double-conversion_FOUND)
+ return()
+endif()
+
+find_path(DOUBLE_CONVERSION_INCLUDE_DIR
+ NAMES
+ double-conversion.h
+ PATH_SUFFIXES
+ double-conversion
+)
+find_library(DOUBLE_CONVERSION_LIBRARY NAMES double-conversion)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+ double-conversion DEFAULT_MSG
+ DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR)
+
+if(double-conversion_FOUND AND NOT TARGET double-conversion::double-conversion)
+ add_library(double-conversion::double-conversion UNKNOWN IMPORTED)
+ set_target_properties(double-conversion::double-conversion PROPERTIES
+ IMPORTED_LOCATION "${DOUBLE_CONVERSION_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${DOUBLE_CONVERSION_INCLUDE_DIR}")
+endif()
+
+mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY)
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake
new file mode 100644
index 0000000000..d7f9788fc5
--- /dev/null
+++ b/cmake/QtBaseConfigureTests.cmake
@@ -0,0 +1,139 @@
+include(CheckCXXSourceCompiles)
+
+function(run_config_test_architecture)
+ # Test architecture
+ set(_arch_file "${CMAKE_CURRENT_BINARY_DIR}/architecture_test")
+ try_compile(_arch_result "${CMAKE_CURRENT_BINARY_DIR}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/arch/arch.cpp"
+ COPY_FILE "${_arch_file}")
+ if (NOT _arch_result)
+ message(FATAL_ERROR "Failed to compile architecture detection file.")
+ endif()
+
+ file(STRINGS "${_arch_file}" _arch_lines LENGTH_MINIMUM 16 LENGTH_MAXIMUM 1024 ENCODING UTF-8)
+
+ foreach (_line ${_arch_lines})
+ string(FIND "${_line}" "==Qt=magic=Qt== Architecture:" _pos)
+ if (_pos GREATER -1)
+ math(EXPR _pos "${_pos}+29")
+ string(SUBSTRING "${_line}" ${_pos} -1 _architecture)
+ endif()
+ string(FIND "${_line}" "==Qt=magic=Qt== Sub-architecture:" _pos)
+ if (_pos GREATER -1)
+ math(EXPR _pos "${_pos}+34")
+ string(SUBSTRING "${_line}" ${_pos} -1 _sub_architecture)
+ string(REPLACE " " ";" _sub_architecture "${_sub_architecture}")
+ endif()
+ string(FIND "${_line}" "==Qt=magic=Qt== Build-ABI:" _pos)
+ if (_pos GREATER -1)
+ math(EXPR _pos "${_pos}+26")
+ string(SUBSTRING "${_line}" ${_pos} -1 _build_abi)
+ endif()
+ endforeach()
+
+ if (NOT _architecture OR NOT _sub_architecture OR NOT _build_abi)
+ message(FATAL_ERROR "Failed to extract architecture data from file.")
+ endif()
+
+ set(TEST_architecture 1 CACHE INTERNAL "Ran the architecture test")
+ set(TEST_architecture_arch "${_architecture}" CACHE INTERNAL "Target machine architecture")
+ set(TEST_subarch 1 CACHE INTERNAL "Ran machine subArchitecture test")
+ foreach(it ${_sub_architecture})
+ set(TEST_subarch_${it} 1 CACHE INTERNAL "Target sub architecture result")
+ endforeach()
+ set(TEST_buildAbi "${_build_abi}" CACHE INTERNAL "Target machine buildAbi")
+endfunction()
+
+
+function(run_config_test_posix_iconv)
+ set(source "#include <iconv.h>
+
+int main(int, char **)
+{
+ iconv_t x = iconv_open(\"\", \"\");
+
+ char *inp;
+ char *outp;
+ size_t inbytes, outbytes;
+ iconv(x, &inp, &inbytes, &outp, &outbytes);
+
+ iconv_close(x);
+
+ return 0;
+}")
+ check_cxx_source_compiles("${source}" HAVE_POSIX_ICONV)
+
+ if(NOT HAVE_POSIX_ICONV)
+ set(_req_libraries "${CMAKE_REQUIRE_LIBRARIES}")
+ set(CMAKE_REQUIRE_LIBRARIES "iconv")
+ check_cxx_source_compiles("${source}" HAVE_POSIX_ICONV)
+ set(CMAKE_REQUIRE_LIBRARIES "${_req_libraries}")
+ if(HAVE_POSIX_ICONV)
+ set(TEST_iconv_needlib 1 CACHE INTERNAL "Need to link against libiconv")
+ endif()
+ endif()
+
+ set(TEST_posix_iconv "${HAVE_POSIX_ICONV}" CACHE INTERNAL "POSIX iconv")
+endfunction()
+
+
+function(run_config_test_sun_iconv)
+ set(source "#include <iconv.h>
+
+int main(int, char **)
+{
+ iconv_t x = iconv_open(\"\", \"\");
+
+ const char *inp;
+ char *outp;
+ size_t inbytes, outbytes;
+ iconv(x, &inp, &inbytes, &outp, &outbytes);
+
+ iconv_close(x);
+
+ return 0;
+}")
+ if(DARWIN)
+ # as per !config.darwin in configure.json
+ set(HAVE_SUN_ICONV OFF)
+ else()
+ check_cxx_source_compiles("${source}" HAVE_SUN_ICONV)
+ endif()
+
+ set(TEST_sun_iconv "${HAVE_SUN_ICONV}" CACHE INTERNAL "SUN libiconv")
+endfunction()
+
+function(run_linker_version_script_support)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version_flag.map" "VERS_1 { global: sym; };
+VERS_2 { global: sym; }
+VERS_1;
+")
+ if(DEFINED CMAKE_REQUIRED_FLAGS)
+ set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
+ else()
+ set(CMAKE_REQUIRED_FLAGS "")
+ endif()
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=\"${CMAKE_CURRENT_BINARY_DIR}/version_flag.map\"")
+ check_cxx_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT)
+ if(DEFINED CMAKE_REQUIRED_FLAGS_SAVE)
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+ endif()
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
+
+ set(TEST_ld_version_script "${HAVE_LD_VERSION_SCRIPT}" CACHE INTERNAL "linker version script support")
+endfunction()
+
+function(run_config_tests)
+ run_config_test_posix_iconv()
+
+ add_library(Iconv INTERFACE)
+ if(TEST_iconv_needlib)
+ target_link_libraries(Iconv PUBLIC iconv)
+ endif()
+
+ run_config_test_sun_iconv()
+ run_config_test_architecture()
+ run_linker_version_script_support()
+endfunction()
+
+run_config_tests()
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
new file mode 100644
index 0000000000..5b2b746ef1
--- /dev/null
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -0,0 +1,58 @@
+# Where QtBuild.cmake can find QtModuleConfig.cmake.in
+set(Qt${PROJECT_VERSION_MAJOR}_DIR "${PROJECT_SOURCE_DIR}/cmake")
+
+
+## QtPlatform Target:
+set(name "Qt")
+add_library("${name}" INTERFACE)
+add_library("Qt::Platform" ALIAS "${name}")
+target_include_directories("${name}"
+ INTERFACE
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${QT_PLATFORM_DEFINITION_DIR}>
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
+ $<INSTALL_INTERFACE:${INSTALL_DATADIR}/${QT_PLATFORM_DEFINITION_DIR}>
+ $<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>
+ )
+target_compile_definitions("${name}" INTERFACE ${QT_PLATFORM_DEFINITIONS})
+set(config_install_dir "${INSTALL_LIBDIR}/cmake/${name}${PROJECT_VERSION_MAJOR}")
+install(TARGETS "${name}" EXPORT "${name}${PROJECT_VERSION_MAJOR}Targets")
+install(EXPORT "${name}${PROJECT_VERSION_MAJOR}Targets" NAMESPACE Qt:: DESTINATION "${config_install_dir}")
+
+configure_package_config_file(
+ "${PROJECT_SOURCE_DIR}/cmake/QtConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}Config.cmake"
+ INSTALL_DESTINATION "${config_install_dir}"
+)
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}ConfigVersion.cmake
+ VERSION ${PROJECT_VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}Config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/Qt${PROJECT_VERSION_MAJOR}ConfigVersion.cmake"
+ DESTINATION "${config_install_dir}"
+ COMPONENT Devel
+)
+
+
+## Library to hold global features:
+add_library(Qt_global_Config INTERFACE)
+
+qt_feature_module_begin(LIBRARY QtCore
+ PUBLIC_FILE src/corelib/global/qconfig.h
+ PRIVATE_FILE src/corelib/global/qconfig_p.h
+)
+include("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
+qt_feature_module_end(Qt_global_Config)
+
+
+## Install some QtBase specific CMake files:
+install(FILES
+ cmake/QtBuild.cmake
+ cmake/QtFeature.cmake
+ cmake/QtPostProcess.cmake
+ cmake/QtSetup.cmake
+ cmake/QtModuleConfig.cmake.in
+ DESTINATION "${config_install_dir}"
+)
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
new file mode 100644
index 0000000000..cf16be6126
--- /dev/null
+++ b/cmake/QtBuild.cmake
@@ -0,0 +1,1080 @@
+include(CMakePackageConfigHelpers)
+
+# Install locations:
+set(INSTALL_BINDIR "bin" CACHE PATH "Executables [PREFIX/bin]")
+set(INSTALL_INCLUDEDIR "include" CACHE PATH "Header files [PREFIX/include]")
+set(INSTALL_LIBDIR "lib" CACHE PATH "Libraries [PREFIX/lib]")
+set(INSTALL_ARCHDATADIR "." CACHE PATH "Arch-dependent data [PREFIX]")
+set(INSTALL_PLUGINSDIR "${INSTALL_ARCHDATADIR}/plugins" CACHE PATH
+ "Plugins [ARCHDATADIR/plugins]")
+
+set(INSTALL_TARGETS_DEFAULT_ARGS
+ RUNTIME DESTINATION "${INSTALL_BINDIR}"
+ LIBRARY DESTINATION "${INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${INSTALL_LIBDIR}" COMPONENT Devel
+ INCLUDES DESTINATION "${INSTALL_INCLUDEDIR}"
+)
+
+if (WIN32)
+ set(_default_libexec "${INSTALL_ARCHDATADIR}/bin")
+else()
+ set(_default_libexec "${INSTALL_ARCHDATADIR}/libexec")
+endif()
+
+set(INSTALL_LIBEXECDIR "${_default_libexec}" CACHE PATH
+ "Helper programs [ARCHDATADIR/bin on Windows, ARCHDATADIR/libexec otherwise]")
+set(INSTALL_IMPORTDIR "${INSTALL_ARCHDATADIR}/imports" CACHE PATH
+ "QML1 imports [ARCHDATADIR/imports]")
+set(INSTALL_QMLDIR "${INSTALL_ARCHDATADIR}/qml" CACHE PATH
+ "QML2 imports [ARCHDATADIR/qml]")
+set(INSTALL_DATADIR "." CACHE PATH "Arch-independent data [PREFIX]")
+set(INSTALL_DOCDIR "${INSTALL_DATADIR}/doc" CACHE PATH "Documentation [DATADIR/doc]")
+set(INSTALL_TRANSLATIONSDIR "${INSTALL_DATADIR}/translations" CACHE PATH
+ "Translations [DATADIR/translations]")
+set(INSTALL_SYSCONFDIR "etc/xdg" CACHE PATH
+ "Settings used by Qt programs [PREFIX/etc/xdg]")
+set(INSTALL_EXAMPLESDIR "examples" CACHE PATH "Examples [PREFIX/examples]")
+set(INSTALL_TESTSDIR "tests" CACHE PATH "Tests [PREFIX/tests]")
+
+# Platform define path, etc.
+if(WIN32)
+ set(QT_DEFAULT_PLATFORM_DEFINITIONS UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64)
+ endif()
+ if(MSVC)
+ set(QT_DEFAULT_PLATFORM_DEFINITION_DIR mkspecs/win32-msvc)
+ elseif(CLANG)
+ set(QT_DEFAULT_PLATFORM_DEFINITION_DIR mkspecs/win32-clang)
+ endif()
+elseif(LINUX)
+ if(GCC)
+ set(QT_DEFAULT_PLATFORM_DEFINITION_DIR mkspecs/linux-g++)
+ elseif(CLANG)
+ set(QT_DEFAULT_PLATFORM_DEFINITION_DIR mkspecs/linux-clang)
+ endif()
+elseif(APPLE)
+ set(QT_DEFAULT_PLATFORM_DEFINITION_DIR mkspecs/macx-clang)
+endif()
+
+if(NOT DEFINED QT_DEFAULT_PLATFORM_DEFINITIONS)
+ set(QT_DEFAULT_PLATFORM_DEFINITIONS "")
+endif()
+
+set(QT_PLATFORM_DEFINITIONS ${QT_DEFAULT_PLATFORM_DEFINITIONS}
+ CACHE STRING "Qt platform specific pre-processor defines")
+set(QT_PLATFORM_DEFINITION_DIR ${QT_DEFAULT_PLATFORM_DEFINITION_DIR}
+ CACHE PATH "Path to directory that contains qplatformdefs.h")
+set(QT_NAMESPACE "" CACHE STRING "Qt Namespace")
+
+# Reset:
+set(KNOWN_QT_MODULES "" CACHE INTERNAL "Known Qt modules" FORCE)
+
+
+# For adjusting variables when running tests, we need to know what
+# the correct variable is for separating entries in PATH-alike
+# variables.
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(QT_PATH_SEPARATOR "\\;")
+else()
+ set(QT_PATH_SEPARATOR ":")
+endif()
+
+
+# Functions and macros:
+
+# Print all variables defined in the current scope.
+macro(qt_debug_print_variables)
+ cmake_parse_arguments(__arg "DEDUP" "" "MATCH;IGNORE" ${ARGN})
+ message("Known Variables:")
+ get_cmake_property(__variableNames VARIABLES)
+ list (SORT __variableNames)
+ if (__arg_DEDUP)
+ list(REMOVE_DUPLICATES __variableNames)
+ endif()
+
+ foreach(__var ${__variableNames})
+ set(__ignore OFF)
+ foreach(__i ${__arg_IGNORE})
+ if(__var MATCHES "${__i}")
+ set(__ignore ON)
+ break()
+ endif()
+ endforeach()
+
+ if (__ignore)
+ continue()
+ endif()
+
+ set(__show OFF)
+ foreach(__i ${__arg_MATCH})
+ if(__var MATCHES "${__i}")
+ set(__show ON)
+ break()
+ endif()
+ endforeach()
+
+ if (__show)
+ message(" ${__var}=${${__var}}.")
+ endif()
+ endforeach()
+endmacro()
+
+
+macro(assert)
+ if (${ARGN})
+ else()
+ message(FATAL_ERROR "ASSERT: ${ARGN}.")
+ endif()
+endmacro()
+
+
+function(qt_ensure_perl)
+ if(DEFINED HOST_PERL)
+ return()
+ endif()
+ find_program(HOST_PERL "perl" DOC "Perl binary")
+ if (NOT HOST_PERL)
+ message(FATAL_ERROR "Perl needs to be available to build Qt.")
+ endif()
+endfunction()
+
+
+# A version of cmake_parse_arguments that makes sure all arguments are processed and errors out
+# with a message about ${type} having received unknown arguments.
+macro(qt_parse_all_arguments result type flags options multiopts)
+ cmake_parse_arguments(${result} "${flags}" "${options}" "${multiopts}" ${ARGN})
+ if(DEFINED ${result}_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown arguments were passed to ${type} (${${result}_UNPARSED_ARGUMENTS}).")
+ endif()
+endmacro()
+
+
+# Determines the directory where the generated class-style header files for
+# the specified module are located and stores the result in the given result
+# variable.
+function(qt_internal_module_include_dir result module)
+ set(${result} "${PROJECT_BINARY_DIR}/include/${module}" PARENT_SCOPE)
+endfunction()
+
+function(qt_internal_add_link_flags target to_add)
+ get_target_property(_flags "${target}" LINK_FLAGS)
+ if ("${_flags}" STREQUAL "_flags-NOTFOUND")
+ set(_flags "")
+ endif()
+ string(APPEND _flags " ${to_add}")
+ set_target_properties("${target}" PROPERTIES LINK_FLAGS "${_flags}")
+endfunction()
+
+function(qt_internal_add_linker_version_script target)
+ qt_parse_all_arguments(_arg "qt_internal_add_linker" "INTERNAL" "" "PRIVATE_HEADERS" ${ARGN})
+
+ if (TEST_ld_version_script)
+ if (_arg_INTERNAL)
+ set(contents "Qt_${PROJECT_VERSION_MAJOR}_PRIVATE_API { *; };")
+ else()
+ set(contents "Qt_${PROJECT_VERSION_MAJOR}_PRIVATE_API {\n qt_private_api_tag*;\n")
+ foreach(ph ${_arg_PRIVATE_HEADERS})
+ string(APPEND contents " @FILE:${ph}@\n")
+ endforeach()
+ string(APPEND contents "};\n")
+ set(current "Qt_${PROJECT_VERSION_MAJOR}")
+ if (QT_NAMESPACE STREQUAL "")
+ set(tag_symbol "qt_version_tag")
+ else()
+ set(tag_symbol "qt_version_tag_${QT_NAMESPACE}")
+ endif()
+ string(APPEND contents "${current} { *; };\n")
+
+ foreach(minor_version RANGE ${PROJECT_VERSION_MINOR})
+ set(previous "${current}")
+ set(current "Qt_${PROJECT_VERSION_MAJOR}.${minor_version}")
+ if (minor_version EQUAL ${PROJECT_VERSION_MINOR})
+ string(APPEND contents "${current} { ${tag_symbol}; } ${previous};\n")
+ else()
+ string(APPEND contents "${current} {} ${previous};\n")
+ endif()
+ endforeach()
+
+ set(infile "${CMAKE_CURRENT_BINARY_DIR}/${target}.version.in")
+ set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${target}.version")
+
+ file(GENERATE OUTPUT "${infile}" CONTENT "${contents}")
+
+ qt_ensure_perl()
+
+ add_custom_command(TARGET "${target}" PRE_LINK
+ COMMAND "${HOST_PERL}" "${PROJECT_SOURCE_DIR}/mkspecs/features/data/unix/findclasslist.pl" < "${infile}" > "${outfile}"
+ BYPRODUCTS "${outfile}" DEPENDS "${infile}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMENT "Generating version linker script"
+ )
+ qt_internal_add_link_flags("${target}" "-Wl,--version-script,${outfile}")
+ endif()
+ endif()
+endfunction()
+
+# Generates the necessary rules to run moc on the sources specified after the MOC parameter.
+# The resulting moc files are returned in the variable specified by the result parameter.
+function(qt_internal_wrap_cpp result)
+ # get include dirs
+ qt_get_moc_flags(moc_flags)
+ qt_parse_all_arguments(_arg "qt_internal_wrap_cpp" "" "TARGET;HEADER_FILE_ONLY" "OPTIONS;DEPENDS;MOC" ${ARGN})
+
+ set(moc_files ${_arg_MOC})
+ set(moc_options ${_arg_OPTIONS})
+ set(moc_target ${_arg_TARGET})
+ set(moc_depends ${_arg_DEPENDS})
+ set(wrapped_files "")
+
+ foreach(it ${moc_files})
+ get_filename_component(it ${it} ABSOLUTE)
+ get_filename_component(moc_file_extension ${it} EXT)
+
+ if(${moc_file_extension} STREQUAL ".h")
+ set(file_prefix "moc_")
+ set(file_extension "cpp")
+ else()
+ set(file_prefix "")
+ set(file_extension "moc")
+ endif()
+
+ qt_make_output_file("${it}" "${file_prefix}" "${file_extension}" outfile)
+ qt_create_moc_command("${it}" "${outfile}" "${moc_flags}" "${moc_options}" "${moc_target}" "${moc_depends}")
+ set_source_files_properties(${outfile} PROPERTIES HEADER_FILE_ONLY ${_arg_HEADER_FILE_ONLY})
+ list(APPEND wrapped_files "${outfile}")
+ endforeach()
+ set("${result}" ${wrapped_files} PARENT_SCOPE)
+endfunction()
+
+function(_qt_module_name name result)
+ set("${result}" "Qt${name}" PARENT_SCOPE)
+endfunction()
+
+
+# This function takes a target as a parameter, followed by a list of sources.
+# The sources are scanned for Q_OBJECT/Q_GADGET use as well as the inclusion of
+# moc_*.cpp/*.moc. Rules are created to call moc accordingly at build time and
+# add the generated sources to the target, if the generated code is not
+# directly included otherwise.
+function(qt_internal_automoc target)
+ if ("x${ARGN}" STREQUAL "x")
+ return()
+ endif()
+
+ if(NOT DEFINED QT_MOCSCANNER)
+ get_target_property(mocPath "Qt::moc" LOCATION)
+ get_filename_component(binDirectory "${mocPath}" DIRECTORY)
+ set(QT_MOCSCANNER "${binDirectory}/qmocscanner${CMAKE_EXECUTABLE_SUFFIX}")
+ endif()
+
+ string(REPLACE ";" "\n" sources "${ARGN}")
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/moc_sources_and_headers.txt" ${sources})
+ execute_process(COMMAND "${QT_MOCSCANNER}"
+ "${CMAKE_CURRENT_BINARY_DIR}/moc_sources_and_headers.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/moc_files_included.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/moc_files_to_build.txt"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ )
+
+ file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/moc_files_included.txt" moc_files_included)
+ file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/moc_files_to_build.txt" moc_files_to_build)
+
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/moc_sources_and_headers.txt")
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/moc_files_included.txt")
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/moc_files_to_build.txt")
+
+ qt_internal_wrap_cpp(included_mocs TARGET "${target}" MOC ${moc_files_included} HEADER_FILE_ONLY ON)
+ qt_internal_wrap_cpp(moc_and_build_sources TARGET "${target}" MOC ${moc_files_to_build} HEADER_FILE_ONLY OFF)
+
+ target_sources("${target}" PRIVATE ${moc_and_build_sources} ${included_mocs})
+
+ foreach(generated_source ${included_mocs})
+ get_filename_component(directory "${generated_source}" DIRECTORY)
+ target_include_directories("${target}" PRIVATE "${directory}")
+ endforeach()
+endfunction()
+
+
+# This function takes a target as a parameter, followed by a list of sources.
+# Any sources with the .ui extension are passed on to uic and the generated output
+# is added to the target sources.
+function(qt_internal_autouic target)
+ if ("x${ARGN}" STREQUAL "x")
+ return()
+ endif()
+
+ set(_ui_files "")
+
+ foreach(s ${ARGN})
+ get_filename_component(ext "${s}" EXT)
+ if("${ext}" STREQUAL ".ui")
+ qt_create_uic_command("${s}" _ui_file)
+ list(APPEND _ui_files "${_ui_file}")
+ endif()
+ endforeach()
+ target_sources("${target}" PRIVATE "${_ui_files}")
+endfunction()
+
+
+# This function attempts to (poorly) parse the given resourceFile (.qrc) and
+# determine the dependencies, i.e. which files are intended for inclusion into
+# the Qt resource.
+function(qt_extract_qrc_dependencies resourceFile _out_depends _rc_depends)
+ get_filename_component(rc_path ${resourceFile} PATH)
+
+ if(EXISTS "${infile}")
+ # parse file for dependencies
+ # all files are absolute paths or relative to the location of the qrc file
+ file(READ "${infile}" RC_FILE_CONTENTS)
+ string(REGEX MATCHALL "<file[^<]+" RC_FILES "${RC_FILE_CONTENTS}")
+ set(RC_DEPENDS "")
+ foreach(RC_FILE ${RC_FILES})
+ string(REGEX REPLACE "^<file[^>]*>" "" RC_FILE "${RC_FILE}")
+ if(NOT IS_ABSOLUTE "${RC_FILE}")
+ set(RC_FILE "${rc_path}/${RC_FILE}")
+ endif()
+ set(RC_DEPENDS ${RC_DEPENDS} "${RC_FILE}")
+ endforeach()
+ # Since this cmake function is doing the dependency scanning for these files,
+ # let's make a configured file and add it as a dependency so cmake is run
+ # again when dependencies need to be recomputed.
+ qt_make_output_file("${infile}" "" "qrc.depends" out_depends)
+ configure_file("${infile}" "${out_depends}" COPYONLY)
+ else()
+ # The .qrc file does not exist (yet). Let's add a dependency and hope
+ # that it will be generated later
+ set(out_depends)
+ endif()
+
+ set(${_out_depends} ${out_depends} PARENT_SCOPE)
+ set(${_rc_depends} ${RC_DEPENDS} PARENT_SCOPE)
+endfunction()
+
+
+# This function creates the necessary rule to call rcc on the given
+# resource file and stores the name of the to-be generated C++ source
+# file (created by rcc) in the outCppFile variable.
+function(qt_create_rcc_command resourceFile outCppFile)
+ get_filename_component(outfilename "${resourceFile}" NAME_WE)
+ get_filename_component(infile "${resourceFile}" ABSOLUTE)
+ set(generatedCppFile "${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cpp")
+
+ qt_extract_qrc_dependencies("${infile}" _out_depends _rc_depends)
+ set_source_files_properties("${infile}" PROPERTIES SKIP_AUTORCC ON)
+
+ add_custom_command(OUTPUT "${generatedCppFile}"
+ COMMAND "Qt::rcc" --name "${outfilename}" --output "${generatedCppFile}" "${infile}"
+ MAIN_DEPENDENCY "${infile}"
+ DEPENDS "${_rc_depends}" "${_out_depends}" VERBATIM)
+ set_source_files_properties("${generatedCppFile}" PROPERTIES SKIP_AUTOMOC ON)
+ set_source_files_properties("${generatedCppFile}" PROPERTIES SKIP_AUTOUIC ON)
+ set("${outCppFile}" "${generatedCppFile}" PARENT_SCOPE)
+endfunction()
+
+
+# This function takes a target as a parameter, followed by a list of sources.
+# Any sources ending with the .qrc extension are treated as Qt resources and rules
+# to call rcc are generated. The source files rcc generates are added to the target.
+function(qt_internal_autorcc target)
+ if ("x${ARGN}" STREQUAL "x")
+ return()
+ endif()
+
+ set(_qrc_cpp_files "")
+
+ foreach(s ${ARGN})
+ get_filename_component(ext "${s}" EXT)
+ if("${ext}" STREQUAL ".qrc")
+ qt_create_rcc_command("${s}" _qrc_cpp_file)
+ list(APPEND _qrc_cpp_files "${_qrc_cpp_file}")
+ endif()
+ endforeach()
+ target_sources("${target}" PRIVATE "${_qrc_cpp_files}")
+endfunction()
+
+
+# This function takes a target as a parameter, followed by a list of sources.
+# The sources are scanned for .ui and .qrc as well as Q_OBJECT/Q_GADGET use
+# and rules to call uic/rcc/moc are created. Any generated sources are added
+# as private sources to the specified target.
+function(qt_internal_process_automatic_sources target)
+ qt_internal_automoc("${target}" ${ARGN})
+ qt_internal_autouic("${target}" ${ARGN})
+ qt_internal_autorcc("${target}" ${ARGN})
+endfunction()
+
+
+set(__default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES")
+set(__default_public_args "PUBLIC_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_DEFINES")
+
+
+# This function can be used to add sources/libraries/etc. to the specified CMake target
+# if the provided CONDITION evaluates to true.
+function(extend_target target)
+ if (NOT TARGET "${target}")
+ message(FATAL_ERROR "Trying to extend non-existing target \"${target}\".")
+ endif()
+ qt_parse_all_arguments(_arg "extend_target" "" ""
+ "CONDITION;${__default_public_args};${__default_private_args};COMPILE_FLAGS" ${ARGN})
+ if ("x${_arg_CONDITION}" STREQUAL x)
+ set(_arg_CONDITION ON)
+ endif()
+
+ qt_evaluate_config_expression(result ${_arg_CONDITION})
+ if (${result})
+ qt_internal_process_automatic_sources("${target}" ${_arg_SOURCES})
+
+ foreach(dep ${_arg_LIBRARIES} ${_arg_PUBLIC_LIBRARIES})
+ if("${dep}" MATCHES "Qt::(.+)(Private?)")
+ set(depTarget ${CMAKE_MATCH_1})
+
+ # Fetch features from dependencies and make them available to the
+ # caller as well as to the local scope for configure.cmake evaluation.
+
+ if("x${CMAKE_MATCH_2}" STREQUAL "xPrivate")
+ qt_push_features_into_parent_scope(PRIVATE_FEATURES ${depTarget})
+ qt_pull_features_into_current_scope(PRIVATE_FEATURES ${depTarget})
+ endif()
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES ${depTarget})
+ qt_pull_features_into_current_scope(PUBLIC_FEATURES ${depTarget})
+ if(TARGET "${dep}")
+ continue()
+ endif()
+ find_package(Qt${PROJECT_VERSION_MAJOR}${depTarget} REQUIRED)
+ endif()
+ endforeach()
+
+ target_sources("${target}" PRIVATE ${_arg_SOURCES})
+ if (_arg_COMPILE_FLAGS)
+ set_source_files_properties(${_arg_SOURCES} PROPERTIES COMPILE_FLAGS "${_arg_COMPILE_FLAGS}")
+ endif()
+ target_include_directories("${target}" PUBLIC ${_arg_PUBLIC_INCLUDE_DIRECTORIES} PRIVATE ${_arg_INCLUDE_DIRECTORIES})
+ target_compile_definitions("${target}" PUBLIC ${_arg_PUBLIC_DEFINES} PRIVATE ${_arg_DEFINES})
+ target_link_libraries("${target}" PUBLIC ${_arg_PUBLIC_LIBRARIES} PRIVATE ${_arg_LIBRARIES})
+ endif()
+endfunction()
+
+
+function(qt_internal_library_deprecation_level result)
+ if(WIN32)
+ # On Windows, due to the way DLLs work, we need to export all functions,
+ # including the inlines
+ set("${result}" "QT_DISABLE_DEPRECATED_BEFORE=0x040800" PARENT_SCOPE)
+ else()
+ # On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API
+ set("${result}" "QT_DISABLE_DEPRECATED_BEFORE=0x050000" PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+function(qt_read_headers_pri module resultVarPrefix)
+ qt_internal_module_include_dir(include_dir "${module}")
+ file(STRINGS "${include_dir}/headers.pri" headers_pri_contents)
+ foreach(line ${headers_pri_contents})
+ if("${line}" MATCHES "SYNCQT.HEADER_FILES = (.*)")
+ set(public_module_headers "${CMAKE_MATCH_1}")
+ separate_arguments(public_module_headers UNIX_COMMAND "${public_module_headers}")
+ elseif("${line}" MATCHES "SYNCQT.PRIVATE_HEADER_FILES = (.*)")
+ set(private_module_headers "${CMAKE_MATCH_1}")
+ separate_arguments(private_module_headers UNIX_COMMAND "${private_module_headers}")
+ elseif("${line}" MATCHES "SYNCQT.GENERATED_HEADER_FILES = (.*)")
+ set(generated_module_headers "${CMAKE_MATCH_1}")
+ separate_arguments(generated_module_headers UNIX_COMMAND "${generated_module_headers}")
+ foreach(generated_header ${generated_module_headers})
+ list(APPEND public_module_headers "${include_dir}/${generated_header}")
+ endforeach()
+ # Ignore INJECTIONS!
+ elseif("${line}" MATCHES "SYNCQT.([A-Z_]+)_HEADER_FILES = (.+)")
+ set(prefix "${CMAKE_MATCH_1}")
+ string(TOLOWER "${prefix}" prefix)
+ set(entries "${CMAKE_MATCH_2}")
+ separate_arguments(entries UNIX_COMMAND "${entries}")
+ set("${resultVarPrefix}_${prefix}" "${entries}" PARENT_SCOPE)
+ endif()
+ endforeach()
+ set(${resultVarPrefix}_public "${public_module_headers}" PARENT_SCOPE)
+ set(${resultVarPrefix}_private "${private_module_headers}" PARENT_SCOPE)
+endfunction()
+
+
+# This is the main entry function for creating a Qt module, that typically
+# consists of a library, public header files, private header files and configurable
+# features.
+#
+# A CMake target with the specified name parameter is created. If the current source
+# directory has a configure.cmake file, then that is also processed for feature definition
+# and testing. Any features defined as well as any features coming from dependencies to
+# this module are imported into the scope of the calling feature.
+function(add_qt_module name)
+ qt_parse_all_arguments(_arg "add_qt_module" "NO_MODULE_HEADERS;STATIC" "CONFIG_MODULE_NAME"
+ "${__default_private_args};${__default_public_args};FEATURE_DEPENDENCIES" ${ARGN})
+
+ _qt_module_name("${name}" module)
+ set(versioned_module_name "Qt${PROJECT_VERSION_MAJOR}${name}")
+ set(target "${name}")
+ string(TOUPPER "${name}" name_upper)
+ string(TOLOWER "${name}" name_lower)
+
+ set(known_modules "${KNOWN_QT_MODULES}" "${target}")
+ set(KNOWN_QT_MODULES ${known_modules} CACHE INTERNAL "Modules that are built." FORCE)
+
+ ### Define Targets:
+ if(${_arg_STATIC})
+ add_library("${target}" STATIC)
+ elseif(${QT_BUILD_SHARED_LIBS})
+ add_library("${target}" SHARED)
+ else()
+ add_library("${target}" STATIC)
+ endif()
+ add_library("Qt::${target}" ALIAS "${target}")
+
+ # Add _private target to link against the private headers:
+ set(target_private "${target}Private")
+ add_library("${target_private}" INTERFACE)
+ add_library("Qt::${target_private}" ALIAS ${target_private})
+
+ if(NOT DEFINED _arg_CONFIG_MODULE_NAME)
+ set(_arg_CONFIG_MODULE_NAME "${name_lower}")
+ endif()
+
+ # Import global features
+ if(NOT "${target}" STREQUAL "Core")
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES PRIVATE_FEATURES FEATURE_PROPERTY_INFIX "GLOBAL_" Qt::Core)
+ endif()
+
+ # Fetch features from dependencies and make them available to the
+ # caller as well as to the local scope for configure.cmake evaluation.
+ foreach(dep ${_arg_LIBRARIES} ${_arg_PUBLIC_LIBRARIES})
+ if("${dep}" MATCHES "(Qt::.+)Private")
+ set(publicDep ${CMAKE_MATCH_1})
+ qt_push_features_into_parent_scope(PRIVATE_FEATURES ${publicDep})
+ qt_pull_features_into_current_scope(PRIVATE_FEATURES ${publicDep})
+ else()
+ set(publicDep ${dep})
+ endif()
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES ${publicDep})
+ qt_pull_features_into_current_scope(PUBLIC_FEATURES ${publicDep})
+ endforeach()
+
+ if(NOT ${_arg_NO_MODULE_HEADERS})
+ qt_ensure_perl()
+ if(NOT DEFINED QT_SYNCQT)
+ get_target_property(mocPath "Qt::moc" LOCATION)
+ get_filename_component(binDirectory "${mocPath}" DIRECTORY)
+ # We could put this into the cache, but on the other hand there's no real need to
+ # pollute the app's cache with this. For the first qtbase build, the variable is
+ # set in global scope.
+ set(QT_SYNCQT "${binDirectory}/syncqt.pl")
+ endif()
+ execute_process(COMMAND "${HOST_PERL}" -w "${QT_SYNCQT}" -quiet -module "${module}" -version "${PROJECT_VERSION}" -outdir "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}")
+ endif()
+
+ if(NOT ${_arg_NO_MODULE_HEADERS})
+ set_target_properties("${target}" PROPERTIES MODULE_HAS_HEADERS ON)
+ else()
+ set_target_properties("${target}" PROPERTIES MODULE_HAS_HEADERS OFF)
+ endif()
+
+ set_target_properties("${target}" PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${INSTALL_LIBDIR}")
+ set_target_properties("${target}" PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${INSTALL_BINDIR}")
+ set_target_properties("${target}" PROPERTIES OUTPUT_NAME "${versioned_module_name}")
+
+ qt_internal_module_include_dir(include_dir "${module}")
+
+ set(configureFile "${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
+ if(EXISTS "${configureFile}")
+ qt_feature_module_begin(
+ LIBRARY "${module}"
+ PUBLIC_FILE "qt${_arg_CONFIG_MODULE_NAME}-config.h"
+ PRIVATE_FILE "qt${_arg_CONFIG_MODULE_NAME}-config_p.h"
+ PUBLIC_DEPENDENCIES ${_arg_FEATURE_DEPENDENCIES}
+ PRIVATE_DEPENDENCIES ${_arg_FEATURE_DEPENDENCIES}
+ )
+ include(${configureFile})
+ qt_feature_module_end("${target}")
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES PRIVATE_FEATURES "${target}")
+
+ set_property(TARGET "${target}" APPEND PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/qt${_arg_CONFIG_MODULE_NAME}-config.h")
+ set_property(TARGET "${target}" APPEND PROPERTY PRIVATE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/qt${_arg_CONFIG_MODULE_NAME}-config_p.h")
+
+ if("${target}" STREQUAL "Core")
+ set_property(TARGET "${target}" APPEND PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig.h")
+ set_property(TARGET "${target}" APPEND PROPERTY PRIVATE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig_p.h")
+ endif()
+ endif()
+
+ qt_internal_library_deprecation_level(deprecation_define)
+
+ extend_target("${target}"
+ SOURCES ${_arg_SOURCES}
+ PUBLIC_INCLUDE_DIRECTORIES
+ $<BUILD_INTERFACE:${include_dir}>
+ $<INSTALL_INTERFACE:include/${module}>
+ ${_arg_PUBLIC_INCLUDE_DIRECTORIES}
+ INCLUDE_DIRECTORIES
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
+ "${include_dir}/${PROJECT_VERSION}"
+ "${include_dir}/${PROJECT_VERSION}/${module}"
+ ${_arg_INCLUDE_DIRECTORIES}
+ PUBLIC_DEFINES
+ ${_arg_PUBLIC_DEFINES}
+ QT_${name_upper}_LIB
+ DEFINES
+ ${_arg_DEFINES}
+ QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
+ QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
+ QT_USE_QSTRINGBUILDER
+ QT_DEPRECATED_WARNINGS
+ QT_BUILDING_QT
+ QT_BUILD_${name_upper}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
+ "${deprecation_define}"
+ PUBLIC_LIBRARIES
+ ${_arg_PUBLIC_LIBRARIES}
+ LIBRARIES
+ ${_arg_LIBRARIES}
+ )
+
+ ### FIXME: Can we replace headers.pri?
+ qt_internal_module_include_dir(include_dir "${module}")
+ if(NOT ${_arg_NO_MODULE_HEADERS})
+ qt_read_headers_pri("${module}" "module_headers")
+ set_property(TARGET "${target}" APPEND PROPERTY PUBLIC_HEADER "${module_headers_public}")
+ set_property(TARGET "${target}" APPEND PROPERTY PRIVATE_HEADER "${module_headers_private}")
+ set_property(TARGET "${target}" APPEND PROPERTY PUBLIC_HEADER "${include_dir}/${module}Depends")
+ endif()
+
+ if(DEFINED module_headers_private)
+ qt_internal_add_linker_version_script("${target}" PRIVATE_HEADERS ${module_headers_private})
+ else()
+ qt_internal_add_linker_version_script("${target}")
+ endif()
+
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES PRIVATE_FEATURES ${_arg_FEATURE_DEPENDENCIES})
+
+ install(TARGETS "${target}" "${target_private}" EXPORT "${versioned_module_name}Targets"
+ LIBRARY DESTINATION ${INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDEDIR}/${module}
+ PRIVATE_HEADER DESTINATION ${INSTALL_INCLUDEDIR}/${module}/${PROJECT_VERSION}/${module}/private
+ )
+
+ set(config_install_dir "${INSTALL_LIBDIR}/cmake/${versioned_module_name}")
+ install(EXPORT "${versioned_module_name}Targets" NAMESPACE Qt:: DESTINATION ${config_install_dir})
+
+ configure_package_config_file(
+ "${Qt${PROJECT_VERSION_MAJOR}_DIR}/QtModuleConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/${versioned_module_name}Config.cmake"
+ INSTALL_DESTINATION "${config_install_dir}"
+ )
+ write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/${versioned_module_name}ConfigVersion.cmake
+ VERSION ${PROJECT_VERSION}
+ COMPATIBILITY AnyNewerVersion
+ )
+
+ set(extra_cmake_files)
+ if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${versioned_module_name}Macros.cmake")
+ list(APPEND extra_cmake_files "${CMAKE_CURRENT_LIST_DIR}/${versioned_module_name}Macros.cmake")
+ endif()
+
+ install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/${versioned_module_name}Config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${versioned_module_name}ConfigVersion.cmake"
+ ${extra_cmake_files}
+ DESTINATION "${config_install_dir}"
+ COMPONENT Devel
+ )
+
+ ### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
+ # that belong to Qt.
+ if (GCC)
+ qt_internal_add_link_flags("${target}" "-Wl,--no-undefined")
+ endif()
+
+ # When a public module depends on private, also make its private depend on the other's private
+ set(_qt_libs_private "")
+ foreach(it ${KNOWN_QT_MODULES})
+ list(FIND _arg_LIBRARIES "Qt::${it}Private" _pos)
+ if(_pos GREATER -1)
+ list(APPEND _qt_libs_private "Qt::${it}Private")
+ endif()
+ endforeach()
+
+ target_link_libraries("${target_private}" INTERFACE "${target}" "${_qt_libs_private}")
+
+ qt_internal_module_include_dir(include_dir "${module}")
+ target_include_directories("${target_private}" INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<BUILD_INTERFACE:${include_dir}/${PROJECT_VERSION}>
+ $<BUILD_INTERFACE:${include_dir}/${PROJECT_VERSION}/${module}>
+ $<INSTALL_INTERFACE:include/${module}/${PROJECT_VERSION}>
+ $<INSTALL_INTERFACE:include/${module}/${PROJECT_VERSION}/${module}>
+ )
+endfunction()
+
+
+# This is the main entry point for defining Qt plugins.
+# A CMake target is created with the given name. The TYPE parameter is needed to place the
+# plugin into the correct plugins/ sub-directory.
+function(add_qt_plugin name)
+ # This is a copy paste of add_qt_module with minor changes and some commented out stuff.
+ # FIXME !!!
+ set(module "${name}")
+ string(TOUPPER "${name}" name_upper)
+
+ qt_parse_all_arguments(_arg "add_qt_plugin" "" "TYPE" "${__default_private_args};${__default_public_args}" ${ARGN})
+ if (NOT DEFINED _arg_TYPE)
+ message(FATAL_ERROR "add_qt_plugin called without setting a TYPE.")
+ endif()
+
+ add_library("${module}")
+ set_target_properties("${module}" PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${INSTALL_PLUGINSDIR}/${_arg_TYPE}")
+ set_target_properties("${module}" PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${INSTALL_BINDIR}")
+
+ # Import global features
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES PRIVATE_FEATURES FEATURE_PROPERTY_INFIX "GLOBAL_" Qt::Core)
+
+ # Fetch features from dependencies and make them available to the
+ # caller as well as to the local scope for configure.cmake evaluation.
+ foreach(dep ${_arg_LIBRARIES} ${_arg_PUBLIC_LIBRARIES})
+ if("${dep}" MATCHES "(Qt::.+)Private")
+ set(publicDep ${CMAKE_MATCH_1})
+ qt_push_features_into_parent_scope(PRIVATE_FEATURES ${publicDep})
+ qt_pull_features_into_current_scope(PRIVATE_FEATURES ${publicDep})
+ else()
+ set(publicDep ${dep})
+ endif()
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES ${publicDep})
+ qt_pull_features_into_current_scope(PUBLIC_FEATURES ${publicDep})
+ endforeach()
+
+ qt_internal_library_deprecation_level(deprecation_define)
+
+ extend_target("${module}"
+ SOURCES ${_arg_SOURCES}
+ INCLUDE_DIRECTORIES
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ ${_arg_INCLUDE_DIRECTORIES}
+ PUBLIC_INCLUDE_DIRECTORIES ${_arg_PUBLIC_INCLUDE_DIRECTORIES}
+ LIBRARIES ${_arg_LIBRARIES}
+ PUBLIC_LIBRARIES ${_arg_PUBLIC_LIBRARIES}
+ DEFINES
+ ${_arg_DEFINES}
+ QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
+ QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
+ QT_USE_QSTRINGBUILDER
+ QT_DEPRECATED_WARNINGS
+ QT_BUILDING_QT
+ QT_BUILD_${name_upper}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
+ "${deprecation_define}"
+ PUBLIC_DEFINES
+ QT_${name_upper}_LIB
+ ${_arg_PUBLIC_DEFINES}
+ )
+
+ install(TARGETS "${module}" EXPORT "${module}Targets"
+ LIBRARY DESTINATION ${INSTALL_PLUGINSDIR}/${_arg_TYPE}
+ ARCHIVE DESTINATION ${INSTALL_LIBDIR}/${_arg_TYPE}
+ )
+ install(EXPORT "${module}Targets" NAMESPACE Qt:: DESTINATION ${INSTALL_LIBDIR}/cmake)
+
+ ### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
+ # that belong to Qt.
+ if (GCC)
+ qt_internal_add_link_flags("${module}" "-Wl,--no-undefined")
+ endif()
+
+ qt_internal_add_linker_version_script(${module})
+endfunction()
+
+
+# This function creates a CMake target for a generic console or GUI binary.
+# Please consider to use a more specific version target like the one created
+# by add_qt_test or add_qt_tool below.
+function(add_qt_executable name)
+ qt_parse_all_arguments(_arg "add_qt_executable" "GUI" "OUTPUT_DIRECTORY" "EXE_FLAGS;${__default_private_args}" ${ARGN})
+
+ if ("x${_arg_OUTPUT_DIRECTORY}" STREQUAL "x")
+ set(_arg_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${INSTALL_BINDIR}")
+ endif()
+
+ add_executable("${name}" ${_arg_EXE_FLAGS})
+ extend_target("${name}"
+ SOURCES ${_arg_SOURCES}
+ INCLUDE_DIRECTORIES
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ ${_arg_INCLUDE_DIRECTORIES}
+ DEFINES ${_arg_DEFINES}
+ LIBRARIES ${_arg_LIBRARIES}
+ )
+ set_target_properties("${name}" PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY "${_arg_OUTPUT_DIRECTORY}"
+ WIN32_EXECUTABLE "${_arg_GUI}"
+ MACOSX_BUNDLE "${_arg_GUI}"
+ )
+endfunction()
+
+
+# This function creates a CMake test target with the specified name for use with CTest.
+function(add_qt_test name)
+ qt_parse_all_arguments(_arg "add_qt_test" "RUN_SERIAL" "" "${__default_private_args}" ${ARGN})
+ set(_path "${CMAKE_CURRENT_BINARY_DIR}")
+
+ add_qt_executable("${name}"
+ OUTPUT_DIRECTORY "${_path}"
+ SOURCES "${_arg_SOURCES}"
+ INCLUDE_DIRECTORIES
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ "${_arg_INCLUDE_DIRECTORIES}"
+ DEFINES "${_arg_DEFINES}"
+ LIBRARIES "Qt::Core;Qt::Test;${_arg_LIBRARIES}"
+ )
+
+ add_test(NAME "${name}" COMMAND "${name}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+
+ set_tests_properties("${name}" PROPERTIES RUN_SERIAL "${_arg_RUN_SERIAL}")
+ set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "PATH=${_path}${QT_PATH_SEPARATOR}${CMAKE_CURRENT_BINARY_DIR}${QT_PATH_SEPARATOR}$ENV{PATH}")
+ set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "QT_PLUGIN_PATH=${PROJECT_BINARY_DIR}/${INSTALL_PLUGINSDIR}")
+endfunction()
+
+
+# This function creates an executable for use as helper program with tests. Some
+# tests launch separate programs to test certainly input/output behavior.
+function(add_qt_test_helper name)
+ add_qt_executable("${name}" OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ${ARGN})
+endfunction()
+
+
+# This function is used to define a "Qt tool", such as moc, uic or rcc.
+# The BOOTSTRAP option allows building it as standalone program, otherwise
+# it will be linked against QtCore.
+function(add_qt_tool name)
+ qt_parse_all_arguments(_arg "add_qt_tool" "BOOTSTRAP" "" "${__default_private_args}" ${ARGN})
+
+ if (_arg_BOOTSTRAP)
+ set(corelib Qt::Bootstrap)
+ else()
+ set(corelib Qt::Core)
+ endif()
+
+ add_qt_executable("${name}" OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${INSTALL_BINDIR}"
+ # Do not pass sources here: They may not get processed when BOOTSTRAP is set!
+ INCLUDE_DIRECTORIES
+ ${_arg_INCLUDE_DIRECTORIES}
+ DEFINES ${_arg_DEFINES}
+ LIBRARIES ${corelib} ${_arg_LIBRARIES}
+ )
+ target_sources("${name}" PRIVATE "${_arg_SOURCES}")
+ add_executable("Qt::${name}" ALIAS "${name}")
+
+ if (NOT _arg_BOOTSTRAP)
+ qt_internal_process_automatic_sources("${name}" ${_arg_SOURCES})
+ endif()
+
+ install(TARGETS "${name}" EXPORT "Qt${PROJECT_VERSION_MAJOR}ToolsTargets" DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS})
+endfunction()
+
+
+
+function(qt_create_tracepoints name tracePointsFile)
+ #### TODO
+ string(TOLOWER "${name}" name)
+
+ file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/qt${name}_tracepoints_p.h" CONTENT
+ "#include <private/qtrace_p.h>")
+endfunction()
+
+
+
+function(add_qt_resource target resourceName)
+ qt_parse_all_arguments(rcc "add_qt_resource" "" "PREFIX;BASE" "FILES" ${ARGN})
+
+ set(qrcContents "<RCC>")
+ if (${rcc_PREFIX})
+ string(APPEND qrcContents " <qresource>\n")
+ else()
+ string(APPEND qrcContents " <qresource prefix=\"${rcc_PREFIX}\">\n")
+ endif()
+
+ foreach(file ${rcc_FILES})
+ get_property(alias SOURCE ${file} PROPERTY alias)
+ if (NOT alias)
+ set(alias "${file}")
+ endif()
+ ### FIXME: escape file paths to be XML conform
+ string(APPEND qrcContents " <file alias=\"${alias}\">${CMAKE_CURRENT_SOURCE_DIR}/${file}</file>\n")
+ endforeach()
+
+ string(APPEND qrcContents " </qresource>\n</RCC>\n")
+ set(generatedResourceFile "${CMAKE_CURRENT_BINARY_DIR}/${resourceName}.qrc")
+ file(GENERATE OUTPUT "${generatedResourceFile}" CONTENT "${qrcContents}")
+
+ set(generatedSourceCode "${CMAKE_CURRENT_BINARY_DIR}/qrc_${resourceName}.cpp")
+ add_custom_command(OUTPUT "${generatedSourceCode}"
+ COMMAND "Qt::rcc"
+ ARGS --name "${resourceName}"
+ --output "${generatedSourceCode}" "${generatedResourceFile}"
+ DEPENDS ${files}
+ COMMENT "RCC ${resourceName}"
+ VERBATIM)
+ target_sources(${target} PRIVATE "${generatedSourceCode}")
+endfunction()
+
+# From Qt5CoreMacros
+# Function used to create the names of output files preserving relative dirs
+function(qt_make_output_file infile prefix ext result)
+ string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
+ string(LENGTH ${infile} _infileLength)
+ set(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
+ if(_infileLength GREATER _binlength)
+ string(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
+ if(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
+ else()
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ endif()
+ else()
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+ endif()
+ if(WIN32 AND rel MATCHES "^([a-zA-Z]):(.*)$") # absolute path
+ set(rel "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
+ endif()
+ set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
+ string(REPLACE ".." "__" _outfile "${_outfile}")
+ get_filename_component(outpath "${_outfile}" PATH)
+ get_filename_component(_outfile "${_outfile}" NAME_WE)
+ file(MAKE_DIRECTORY "${outpath}")
+ set(full_outfile "${outpath}/${prefix}${_outfile}.${ext}")
+ set("${result}" "${full_outfile}" PARENT_SCOPE)
+endfunction()
+
+macro(qt_get_moc_flags _moc_flags)
+ set(${_moc_flags})
+ get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
+
+ if(CMAKE_INCLUDE_CURRENT_DIR)
+ list(APPEND _inc_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+
+ foreach(_current ${_inc_DIRS})
+ if("${_current}" MATCHES "\\.framework/?$")
+ string(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
+ set(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
+ else()
+ set(${_moc_flags} ${${_moc_flags}} "-I${_current}")
+ endif()
+ endforeach()
+
+ get_directory_property(_defines COMPILE_DEFINITIONS)
+ foreach(_current ${_defines})
+ set(${_moc_flags} ${${_moc_flags}} "-D${_current}")
+ endforeach()
+
+ if(WIN32)
+ set(${_moc_flags} ${${_moc_flags}} -DWIN32)
+ endif()
+ if (MSVC)
+ set(${_moc_flags} ${${_moc_flags}} --compiler-flavor=msvc)
+ endif()
+endmacro()
+
+
+# helper to set up a moc rule
+function(qt_create_moc_command infile outfile moc_flags moc_options moc_target moc_depends)
+ # Pass the parameters in a file. Set the working directory to
+ # be that containing the parameters file and reference it by
+ # just the file name. This is necessary because the moc tool on
+ # MinGW builds does not seem to handle spaces in the path to the
+ # file given with the @ syntax.
+ get_filename_component(_moc_outfile_name "${outfile}" NAME)
+ get_filename_component(_moc_outfile_dir "${outfile}" PATH)
+ if(_moc_outfile_dir)
+ set(_moc_working_dir WORKING_DIRECTORY "${_moc_outfile_dir}")
+ endif()
+ set (_moc_parameters_file "${outfile}_parameters")
+ set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
+ string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
+
+ if(moc_target)
+ set(_moc_parameters_file "${_moc_parameters_file}$<$<BOOL:$<CONFIGURATION>>:_$<CONFIGURATION>>")
+ set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>")
+ set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>")
+
+ set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:${targetincludes},\n-I>\n>")
+ set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:${targetdefines},\n-D>\n>")
+
+ file (GENERATE
+ OUTPUT "${_moc_parameters_file}"
+ CONTENT "${targetdefines}${targetincludes}${_moc_parameters}\n"
+ )
+
+ set(targetincludes)
+ set(targetdefines)
+ else()
+ file(WRITE ${_moc_parameters_file} "${_moc_parameters}\n")
+ endif()
+
+ set(_moc_extra_parameters_file @${_moc_parameters_file})
+ add_custom_command(OUTPUT "${outfile}"
+ COMMAND "Qt::moc" "${_moc_extra_parameters_file}"
+ DEPENDS "${infile}" ${moc_depends}
+ ${_moc_working_dir}
+ VERBATIM)
+endfunction()
+
+
+# helper to set up a uic rule
+function(qt_create_uic_command infile _result)
+ # Pass the parameters in a file. Set the working directory to
+ # be that containing the parameters file and reference it by
+ # just the file name. This is necessary because the moc tool on
+ # MinGW builds does not seem to handle spaces in the path to the
+ # file given with the @ syntax.
+ get_filename_component(_uic_basename "${infile}" NAME_WE)
+ set(outfile "ui_${_uic_basename}.h")
+ add_custom_command(OUTPUT "${outfile}"
+ COMMAND "Qt::uic" "${CMAKE_CURRENT_SOURCE_DIR}/${infile}" -o "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
+ DEPENDS "${infile}"
+ COMMENT "Running UIC on ${infile}."
+ VERBATIM)
+ set(${_result} "${CMAKE_CURRENT_BINARY_DIR}/${outfile}" PARENT_SCOPE)
+endfunction()
+
+
+function(qt_generate_forwarding_headers module)
+ qt_parse_all_arguments(_arg "qt_generate_forwarding_headers"
+ "PRIVATE" "SOURCE;DESTINATION" "CLASSES" ${ARGN})
+ qt_internal_module_include_dir(include_dir "${module}")
+
+ if (NOT _arg_DESTINATION)
+ get_filename_component(_arg_DESTINATION "${_arg_SOURCE}" NAME)
+ endif()
+
+ if (_arg_PRIVATE)
+ set(main_fwd "${include_dir}/${PROJECT_VERSION}/${module}/private/${_arg_DESTINATION}")
+ else()
+ set(main_fwd "${include_dir}/${_arg_DESTINATION}")
+ endif()
+
+ get_filename_component(main_fwd_dir "${main_fwd}" DIRECTORY)
+ file(RELATIVE_PATH relpath "${main_fwd_dir}" "${CMAKE_CURRENT_BINARY_DIR}/${_arg_SOURCE}")
+ set(main_contents "#include \"${relpath}\"")
+ file(GENERATE OUTPUT "${main_fwd}" CONTENT "${main_contents}")
+
+ foreach(class_fwd ${_arg_CLASSES})
+ set(class_fwd_contents "#include \"${fwd_hdr}\"")
+ message("Generating forwarding header: ${class_fwd} -> ${relpath}.")
+ file(GENERATE OUTPUT "${include_dir}/${class_fwd}" CONTENT "${class_fwd_contents}")
+ endforeach()
+endfunction()
+
+
+function(add_qt_docs qdocFile)
+ # TODO
+endfunction()
diff --git a/cmake/QtCompilerOptimization.cmake b/cmake/QtCompilerOptimization.cmake
new file mode 100644
index 0000000000..151d06925b
--- /dev/null
+++ b/cmake/QtCompilerOptimization.cmake
@@ -0,0 +1,106 @@
+if (QCC)
+ set(QT_CFLAGS_SSE2 "-msse2")
+ set(QT_CFLAGS_SSE3 "-msse3")
+ set(QT_CFLAGS_SSSE3 "-mssse3")
+ set(QT_CFLAGS_SSE4_1 "-msse4.1")
+ set(QT_CFLAGS_SSE4_2 "-msse4.2")
+ set(QT_CFLAGS_AVX "-mavx")
+ set(QT_CFLAGS_AVX2 "-mavx2")
+ set(QT_CFLAGS_AESNI "-maes")
+ set(QT_CFLAGS_SHANI "-msha")
+endif()
+
+if (MSVC)
+ if (QT_64BIT)
+ # SSE2 is mandatory on 64-bit mode, so skip the option. It triggers:
+ # cl : Command line warning D9002 : ignoring unknown option '-arch:SSE2'
+ set(QT_CFLAGS_SSE2 "")
+ else()
+ set(QT_CFLAGS_SSE2 "-arch:SSE2")
+ endif()
+ set(QT_CFLAGS_SSE3 "${QT_CFLAGS_SSE2}")
+ set(QT_CFLAGS_SSSE3 "${QT_CFLAGS_SSE2}")
+ set(QT_CFLAGS_SSE4_1 "${QT_CFLAGS_SSE2}")
+ set(QT_CFLAGS_SSE4_2 "${QT_CFLAGS_SSE2}")
+ set(QT_CFLAGS_AESNI "${QT_CFLAGS_SSE2}")
+ set(QT_CFLAGS_SHANI "${QT_CFLAGS_SSE2}")
+endif()
+
+if(GCC OR CLANG)
+ set(QT_CFLAGS_SSE2 "-msse2")
+ set(QT_CFLAGS_SSE3 "-msse3")
+ set(QT_CFLAGS_SSSE3 "-mssse3")
+ set(QT_CFLAGS_SSE4_1 "-msse4.1")
+ set(QT_CFLAGS_SSE4_2 "-msse4.2")
+ set(QT_CFLAGS_F16C "-mf16c")
+ set(QT_CFLAGS_RDRND "-mrdrnd")
+ set(QT_CFLAGS_AVX "-mavx")
+ set(QT_CFLAGS_AVX2 "-mavx2")
+ set(QT_CFLAGS_AVX512F "-mavx512f")
+ set(QT_CFLAGS_AVX512ER "-mavx512er")
+ set(QT_CFLAGS_AVX512CD "-mavx512cd")
+ set(QT_CFLAGS_AVX512PF "-mavx512pf")
+ set(QT_CFLAGS_AVX512DQ "-mavx512dq")
+ set(QT_CFLAGS_AVX512BW "-mavx512bw")
+ set(QT_CFLAGS_AVX512VL "-mavx512vl")
+ set(QT_CFLAGS_AVX512IFMA "-mavx512ifma")
+ set(QT_CFLAGS_AVX512VBMI "-mavx512vbmi")
+ set(QT_CFLAGS_AESNI "-maes")
+ set(QT_CFLAGS_SHANI "-msha")
+ set(QT_CFLAGS_NEON "-mfpu=neon")
+ set(QT_CFLAGS_MIPS_DSP "-mdsp")
+ set(QT_CFLAGS_MIPS_DSPR2 "-mdspr2")
+endif()
+
+if (winrt) # FIXME: Correct variable
+ set(QT_CFLAGS_SSE2 "-arch:SSE2")
+ set(QT_CFLAGS_SSE3 "-arch:SSE2")
+ set(QT_CFLAGS_SSSE3 "-arch:SSE2")
+ set(QT_CFLAGS_SSE4_1 "-arch:SSE2")
+ set(QT_CFLAGS_SSE4_2 "-arch:SSE2")
+ set(QT_CFLAGS_AVX "-arch:AVX")
+ set(QT_CFLAGS_AVX2 "-arch:AVX")
+ set(QT_CFLAGS_AESNI "-arch:SSE2")
+ set(QT_CFLAGS_SHANI "-arch:SSE2")
+endif()
+
+if (ICC)
+ if (MSVC)
+ set(QT_CFLAGS_SSE2 "-QxSSE2")
+ set(QT_CFLAGS_SSE3 "-QxSSE3")
+ set(QT_CFLAGS_SSSE3 "-QxSSSE3")
+ set(QT_CFLAGS_SSE4_1 "-QxSSE4.1")
+ set(QT_CFLAGS_SSE4_2 "-QxSSE4.2")
+ set(QT_CFLAGS_AVX "-QxAVX")
+ set(QT_CFLAGS_AVX2 "-QxCORE-AVX2")
+ set(QT_CFLAGS_AVX512F "-QxCOMMON-AVX512")
+ set(QT_CFLAGS_AVX512CD "-QxCOMMON-AVX512")
+ set(QT_CFLAGS_AVX512ER "-QxMIC-AVX512")
+ set(QT_CFLAGS_AVX512PF "-QxMIC-AVX512")
+ set(QT_CFLAGS_AVX512DQ "-QxCORE-AVX512")
+ set(QT_CFLAGS_AVX512BW "-QxCORE-AVX512")
+ set(QT_CFLAGS_AVX512VL "-QxCORE-AVX512")
+ set(QT_CFLAGS_F16C "${QT_CFLAGS_AVX2}")
+ set(QT_CFLAGS_AESNI "-QxSSE2")
+ set(QT_CFLAGS_SHANI "-QxSSE4.2")
+ else()
+ set(QT_CFLAGS_SSE2 "-msse2")
+ set(QT_CFLAGS_SSE3 "-msse3")
+ set(QT_CFLAGS_SSSE3 "-mssse3")
+ set(QT_CFLAGS_SSE4_1 "-msse4.1")
+ set(QT_CFLAGS_SSE4_2 "-msse4.2")
+ set(QT_CFLAGS_AVX "-march=core-avx")
+ set(QT_CFLAGS_AVX2 "-march=core-avx2")
+ set(QT_CFLAGS_AVX512F "-march=broadwell -xCOMMON-AVX512")
+ set(QT_CFLAGS_AVX512CD "-march=broadwell -xCOMMON-AVX512")
+ set(QT_CFLAGS_AVX512ER "-march=knl")
+ set(QT_CFLAGS_AVX512PF "-march=knl")
+ set(QT_CFLAGS_AVX512DQ "-march=skylake-avx512")
+ set(QT_CFLAGS_AVX512BW "-march=skylake-avx512")
+ set(QT_CFLAGS_AVX512VL "-march=skylake-avx512")
+ set(QT_CFLAGS_AESNI "-maes")
+ set(QT_CFLAGS_F16C "${QT_CFLAGS_AVX2}")
+ set(QT_CFLAGS_RDRND "-mrdrnd")
+ set(QT_CFLAGS_SHANI "-msha")
+ endif()
+endif()
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in
new file mode 100644
index 0000000000..ad618b7acc
--- /dev/null
+++ b/cmake/QtConfig.cmake.in
@@ -0,0 +1,43 @@
+@PACKAGE_INIT@
+
+# Slightly amended version of ./src/corelib/Qt5Config.cmake.in
+if (CMAKE_VERSION VERSION_LESS 3.1.0)
+ message(FATAL_ERROR "Qt requires at least CMake version 3.1.0")
+endif()
+
+get_filename_component(_qt5_install_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
+
+include("${CMAKE_CURRENT_LIST_DIR}/Qt5Targets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/Qt5ToolsTargets.cmake")
+
+# if (NOT Qt_FIND_COMPONENTS)
+# set(Qt_NOT_FOUND_MESSAGE "The Qt package requires at least one component")
+# set(Qt_FOUND False)
+# return()
+# endif()
+
+foreach(module ${Qt_FIND_COMPONENTS})
+ find_package(Qt${module}
+ ${_Qt_FIND_PARTS_QUIET}
+ ${_Qt_FIND_PARTS_REQUIRED}
+ PATHS ${_qt_install_prefix} NO_DEFAULT_PATH
+ )
+ if (NOT Qt${module}_FOUND)
+ string(CONFIGURE ${_qt5_module_location_template} _expected_module_location @ONLY)
+
+ if (Qt_FIND_REQUIRED_${module})
+ set(_Qt_NOTFOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"\n")
+ elseif(NOT Qt_FIND_QUIETLY)
+ message(WARNING "Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"")
+ endif()
+
+ unset(_expected_module_location)
+ endif()
+endforeach()
+
+set(QT_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
+
+if (_Qt_NOTFOUND_MESSAGE)
+ set(Qt_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}")
+ set(Qt_FOUND False)
+endif()
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
new file mode 100644
index 0000000000..a4d9421935
--- /dev/null
+++ b/cmake/QtFeature.cmake
@@ -0,0 +1,435 @@
+function(qt_feature_module_begin)
+ qt_parse_all_arguments(_arg "qt_feature_module_begin"
+ "" "LIBRARY;PRIVATE_FILE;PUBLIC_FILE" "PUBLIC_DEPENDENCIES;PRIVATE_DEPENDENCIES" ${ARGN})
+
+ if ("${_arg_LIBRARY}" STREQUAL "")
+ message(FATAL_ERROR "qt_feature_begin_module needs a LIBRARY name!")
+ endif()
+ if ("${_arg_PUBLIC_FILE}" STREQUAL "")
+ message(FATAL_ERROR "qt_feature_begin_module needs a PUBLIC_FILE name!")
+ endif()
+ if ("${_arg_PRIVATE_FILE}" STREQUAL "")
+ message(FATAL_ERROR "qt_feature_begin_module needs a PRIVATE_FILE name!")
+ endif()
+
+ set(__QtFeature_library "${_arg_LIBRARY}" PARENT_SCOPE)
+ set(__QtFeature_private_features "" PARENT_SCOPE)
+ set(__QtFeature_public_features "" PARENT_SCOPE)
+
+ set(__QtFeature_private_file "${_arg_PRIVATE_FILE}" PARENT_SCOPE)
+ set(__QtFeature_public_file "${_arg_PUBLIC_FILE}" PARENT_SCOPE)
+
+ set(__QtFeature_private_extra "" PARENT_SCOPE)
+ set(__QtFeature_public_extra "" PARENT_SCOPE)
+
+ qt_push_features_into_parent_scope(PUBLIC_FEATURES ${_arg_PUBLIC_DEPENDENCIES})
+ qt_push_features_into_parent_scope(PRIVATE_FEATURES ${_arg_PRIVATE_DEPENDENCIES})
+endfunction()
+
+function(qt_feature _feature)
+ set(QT_FEATURE_DEFINITION_${_feature} ${ARGN} PARENT_SCOPE)
+ qt_parse_all_arguments(_arg "qt_feature"
+ "PRIVATE;PUBLIC"
+ "LABEL;PURPOSE;SECTION;" "AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF" ${ARGN})
+
+ if("${_arg_EMIT_IF}" STREQUAL "")
+ set(_arg_EMIT_IF 1)
+ endif()
+
+ if (${_arg_EMIT_IF})
+ set(QT_FEATURE_${_feature} "UNSET" CACHE STRING "${_arg_LABEL}")
+ set_property(CACHE QT_FEATURE_${_feature} PROPERTY STRINGS UNSET ON OFF)
+
+ # Register feature for future use:
+ if (_arg_PUBLIC)
+ list(APPEND __QtFeature_public_features "${_feature}")
+ endif()
+ if (_arg_PRIVATE)
+ list(APPEND __QtFeature_private_features "${_feature}")
+ endif()
+ endif()
+ set(__QtFeature_public_features ${__QtFeature_public_features} PARENT_SCOPE)
+ set(__QtFeature_private_features ${__QtFeature_private_features} PARENT_SCOPE)
+endfunction()
+
+function(qt_evaluate_to_boolean expressionVar)
+ if(${${expressionVar}})
+ set(${expressionVar} ON PARENT_SCOPE)
+ else()
+ set(${expressionVar} OFF PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(qt_evaluate_config_expression resultVar)
+ set(result "")
+ set(nestingLevel 0)
+ set(skipNext OFF)
+ set(expression "${ARGN}")
+ list(LENGTH expression length)
+
+ math(EXPR length "${length}-1")
+ foreach(memberIdx RANGE ${length})
+ if(${skipNext})
+ set(skipNext OFF)
+ continue()
+ endif()
+
+ list(GET expression ${memberIdx} member)
+
+ if("${member}" STREQUAL "(")
+ if(${nestingLevel} GREATER 0)
+ list(APPEND result ${member})
+ endif()
+ math(EXPR nestingLevel "${nestingLevel} + 1")
+ continue()
+ elseif("${member}" STREQUAL ")")
+ math(EXPR nestingLevel "${nestingLevel} - 1")
+ if(nestingLevel LESS 0)
+ break()
+ endif()
+ if(${nestingLevel} EQUAL 0)
+ qt_evaluate_config_expression(result ${result})
+ else()
+ list(APPEND result ${member})
+ endif()
+ continue()
+ elseif(${nestingLevel} GREATER 0)
+ list(APPEND result ${member})
+ continue()
+ elseif("${member}" STREQUAL "NOT")
+ list(APPEND result ${member})
+ continue()
+ elseif("${member}" STREQUAL "AND")
+ qt_evaluate_to_boolean(result)
+ if(NOT ${result})
+ break()
+ endif()
+ set(result "")
+ elseif("${member}" STREQUAL "OR")
+ qt_evaluate_to_boolean(result)
+ if(${result})
+ break()
+ endif()
+ set(result "")
+ elseif("${member}" STREQUAL "STREQUAL" AND memberIdx LESS ${length})
+ # Unfortunately the semantics for STREQUAL in if() are broken when the
+ # RHS is an empty string and the parameters to if are coming through a variable.
+ # So we expect people two write the empty string with single quotes and then we
+ # do the comparison manually here.
+ list(LENGTH result lhsIndex)
+ math(EXPR lhsIndex "${lhsIndex}-1")
+ list(GET result ${lhsIndex} lhs)
+ list(REMOVE_AT result ${lhsIndex})
+ set(lhs "${${lhs}}")
+
+ math(EXPR rhsIndex "${memberIdx}+1")
+ set(skipNext ON)
+
+ list(GET expression ${rhsIndex} rhs)
+ # We can't pass through an empty string with double quotes through various
+ # stages of substitution, so instead it is represented using single quotes
+ # and resolve here.
+ string(REGEX REPLACE "'(.*)'" "\\1" rhs "${rhs}")
+
+ string(COMPARE EQUAL "${lhs}" "${rhs}" stringCompareResult)
+ list(APPEND result ${stringCompareResult})
+ else()
+ string(FIND "${member}" "QT_FEATURE_" idx)
+ if(idx EQUAL 0)
+ # Remove the QT_FEATURE_ prefix
+ string(SUBSTRING "${member}" 11 -1 feature)
+ qt_evaluate_feature(${feature})
+ endif()
+
+ list(APPEND result ${member})
+ endif()
+ endforeach()
+
+ if("${result}" STREQUAL "")
+ set(result ON)
+ else()
+ qt_evaluate_to_boolean(result)
+ endif()
+
+ set(${resultVar} ${result} PARENT_SCOPE)
+endfunction()
+
+function(qt_evaluate_feature _feature)
+ # If the feature was set explicitly by the user to be on or off, in the cache, then
+ # there's nothing for us to do.
+ if(NOT QT_FEATURE_${_feature} STREQUAL UNSET)
+ return()
+ endif()
+
+ if(NOT DEFINED QT_FEATURE_DEFINITION_${_feature})
+ message(FATAL_ERROR "Attempting to evaluate feature ${_feature} but its definition is missing. Either the feature does not exist or a dependency to the module that defines it is missing")
+ endif()
+
+ cmake_parse_arguments(_arg
+ "PRIVATE;PUBLIC"
+ "LABEL;PURPOSE;SECTION;" "AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF" ${QT_FEATURE_DEFINITION_${_feature}})
+
+ if(DEFINED QT_FEATURE_COMPUTED_VALUE_${_feature})
+ set(QT_FEATURE_${_feature} ${QT_FEATURE_COMPUTED_VALUE_${_feature}} PARENT_SCOPE)
+ return()
+ endif()
+
+ if("${_arg_ENABLE}" STREQUAL "")
+ set(_arg_ENABLE OFF)
+ endif()
+
+ if("${_arg_DISABLE}" STREQUAL "")
+ set(_arg_DISABLE OFF)
+ endif()
+
+ if("${_arg_AUTODETECT}" STREQUAL "")
+ set(_arg_AUTODETECT ON)
+ endif()
+
+ if("${_arg_CONDITION}" STREQUAL "")
+ set(_arg_CONDITION ON)
+ endif()
+
+ if(${_arg_DISABLE})
+ set(result OFF)
+ elseif((${_arg_ENABLE}) OR (${_arg_AUTODETECT}))
+ qt_evaluate_config_expression(result ${_arg_CONDITION})
+ else()
+ # feature not auto-detected and not explicitly enabled
+ set(result OFF)
+ endif()
+
+ set(QT_FEATURE_COMPUTED_VALUE_${_feature} "${result}" CACHE INTERNAL "${_arg_LABEL}")
+ set(QT_FEATURE_${_feature} "${result}" PARENT_SCOPE)
+endfunction()
+
+function(qt_feature_definition _feature _name)
+ qt_parse_all_arguments(_arg "qt_feature_definition" "NEGATE" "VALUE" "" ${ARGN})
+
+ # Generate code:
+ set(_expected 1)
+ if (_arg_NEGATE)
+ set(_expected -1)
+ endif()
+ set(_msg "\n#if defined(QT_FEATURE_${_feature}) && QT_FEATURE_${_feature} == ${_expected}\n")
+ if (_arg_VALUE)
+ string(APPEND _msg "# define ${_name} ${_arg_VALUE}\n")
+ else()
+ string(APPEND _msg "# define ${_name}\n")
+ endif()
+ string(APPEND _msg "#endif\n")
+
+ # Store for later use:
+ list(FIND __QtFeature_public_features "${_feature}" _public_index)
+ if (_public_index GREATER -1)
+ string(APPEND __QtFeature_public_extra "${_msg}")
+ endif()
+ list(FIND __QtFeature_private_features "${_feature}" _private_index)
+ if (_private_index GREATER -1)
+ string(APPEND __QtFeature_private_extra "${_msg}")
+ endif()
+
+ set(__QtFeature_public_extra ${__QtFeature_public_extra} PARENT_SCOPE)
+ set(__QtFeature_private_extra ${__QtFeature_private_extra} PARENT_SCOPE)
+endfunction()
+
+function(qt_extra_definition _name _value)
+ qt_parse_all_arguments(_arg "qt_extra_definition" "PUBLIC;PRIVATE" "" "" ${ARGN})
+
+ if (_arg_PUBLIC)
+ string(APPEND __QtFeature_public_extra "\n#define ${_name} ${_value}\n")
+ elseif(_arg_PRIVATE)
+ string(APPEND __QtFeature_private_extra "\n#define ${_name} ${_value}\n")
+ endif()
+
+ set(__QtFeature_public_extra ${__QtFeature_public_extra} PARENT_SCOPE)
+ set(__QtFeature_private_extra ${__QtFeature_private_extra} PARENT_SCOPE)
+endfunction()
+
+function(_qt_generate_feature_line _line _feature)
+ set(_line "")
+ if (QT_FEATURE_${_feature} STREQUAL "ON")
+ set(_line "#define QT_FEATURE_${_feature} 1\n\n" PARENT_SCOPE)
+ elseif(QT_FEATURE_${_feature} STREQUAL "OFF")
+ set(_line "#define QT_FEATURE_${_feature} -1\n\n" PARENT_SCOPE)
+ elseif(QT_FEATURE_${_feature} STREQUAL "UNSET")
+ set(_line "#define QT_FEATURE_${_feature} 0\n\n" PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "${_feature} has unexpected value \"${QT_FEATURE_${_feature}}\"!")
+ endif()
+endfunction()
+
+function(_qt_feature_write_file _file _features _extra)
+ message("Generating file ${_file}.")
+ set(_contents "")
+ foreach(_it ${_features})
+ _qt_generate_feature_line(_line "${_it}")
+ string(APPEND _contents "${_line}")
+ endforeach()
+ string(APPEND _contents "${_extra}")
+
+ file(GENERATE OUTPUT "${_file}" CONTENT "${_contents}")
+endfunction()
+
+function(qt_feature_module_end target)
+ set(all_features ${__QtFeature_public_features} ${__QtFeature_private_features})
+ list(REMOVE_DUPLICATES all_features)
+
+ foreach(feature ${all_features})
+ unset(QT_FEATURE_COMPUTED_VALUE_${feature} CACHE)
+ endforeach()
+
+ foreach(feature ${all_features})
+ qt_evaluate_feature(${feature})
+
+ set(QT_FEATURE_${feature} ${QT_FEATURE_${feature}} PARENT_SCOPE)
+ endforeach()
+
+ set(enabled_public_features "")
+ set(disabled_public_features "")
+ set(enabled_private_features "")
+ set(disabled_private_features "")
+
+ foreach(feature ${__QtFeature_public_features})
+ if(QT_FEATURE_${feature})
+ list(APPEND enabled_public_features ${feature})
+ else()
+ list(APPEND disabled_public_features ${feature})
+ endif()
+ endforeach()
+
+ foreach(feature ${__QtFeature_private_features})
+ if(QT_FEATURE_${feature})
+ list(APPEND enabled_private_features ${feature})
+ else()
+ list(APPEND disabled_private_features ${feature})
+ endif()
+ endforeach()
+
+ foreach(feature ${all_features})
+ unset(QT_FEATURE_COMPUTED_VALUE_${feature} CACHE)
+ unset(QT_FEATURE_DEFINITION_${feature} CACHE)
+ endforeach()
+
+ _qt_feature_write_file("${CMAKE_CURRENT_BINARY_DIR}/${__QtFeature_private_file}"
+ "${__QtFeature_private_features}" "${__QtFeature_private_extra}"
+ )
+ qt_generate_forwarding_headers("${__QtFeature_library}" SOURCE "${__QtFeature_private_file}" PRIVATE)
+
+ _qt_feature_write_file("${CMAKE_CURRENT_BINARY_DIR}/${__QtFeature_public_file}"
+ "${__QtFeature_public_features}" "${__QtFeature_public_extra}"
+ )
+ qt_generate_forwarding_headers("${__QtFeature_library}" SOURCE "${__QtFeature_public_file}")
+
+ get_target_property(targetType "${target}" TYPE)
+ if("${targetType}" STREQUAL "INTERFACE_LIBRARY")
+ set(propertyPrefix "INTERFACE_")
+ else()
+ set(propertyPrefix "")
+ set_target_properties("${target}" PROPERTIES EXPORT_PROPERTIES "QT_ENABLED_PUBLIC_FEATURES;QT_DISABLED_PUBLIC_FEATURES;QT_ENABLED_PRIVATE_FEATURES;QT_DISABLED_PRIVATE_FEATURES")
+ endif()
+ foreach(visibility public private)
+ string(TOUPPER "${visibility}" capitalVisibility)
+ foreach(state enabled disabled)
+ string(TOUPPER "${state}" capitalState)
+
+ set_property(TARGET "${target}" PROPERTY ${propertyPrefix}QT_${capitalState}_${capitalVisibility}_FEATURES "${${state}_${visibility}_features}")
+ endforeach()
+ endforeach()
+
+ unset(__QtFeature_library PARENT_SCOPE)
+ unset(__QtFeature_private_features PARENT_SCOPE)
+ unset(__QtFeature_public_features PARENT_SCOPE)
+
+ unset(__QtFeature_private_file PARENT_SCOPE)
+ unset(__QtFeature_public_file PARENT_SCOPE)
+
+ unset(__QtFeature_private_extra PARENT_SCOPE)
+ unset(__QtFeature_public_extra PARENT_SCOPE)
+endfunction()
+
+function(qt_config_compile_test name)
+ cmake_parse_arguments(_arg "" "LABEL" "" ${ARGN})
+
+ check_cxx_source_compiles("${_arg_UNPARSED_ARGUMENTS}" HAVE_${name})
+ set(TEST_${name} "${HAVE_${name}}" CACHE INTERNAL "${_arg_LABEL}")
+endfunction()
+
+function(qt_config_compile_test_x86simd extension label)
+ string(TOUPPER ${extension} extension_uppercase)
+ try_compile(TEST_X86SIMD_${extension} "${CMAKE_CURRENT_BINARY_DIR}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/x86_simd/main.cpp"
+ COMPILE_DEFINITIONS -DQT_COMPILER_SUPPORTS_${extension_uppercase}
+ OUTPUT_VARIABLE foo
+ )
+ set(TEST_subarch_${extension} "${TEST_X86SIMD_${extension}}" CACHE INTERNAL "${label}" )
+endfunction()
+
+function(qt_pull_features_into_current_scope)
+ cmake_parse_arguments(__arg "PUBLIC_FEATURES;PRIVATE_FEATURES" "FEATURE_PROPERTY_INFIX" "" ${ARGN})
+ foreach(__target IN ITEMS ${__arg_UNPARSED_ARGUMENTS})
+ if(NOT TARGET ${__target})
+ continue()
+ endif()
+ get_target_property(__target_type "${__target}" TYPE)
+ if("${__target_type}" STREQUAL "INTERFACE_LIBRARY")
+ set(__property_prefix "INTERFACE_")
+ else()
+ set(__property_prefix "")
+ endif()
+ foreach(__visibility PUBLIC PRIVATE)
+ set(__value ON)
+ foreach(__state ENABLED DISABLED)
+ if(NOT ${__arg_${__visibility}_FEATURES})
+ continue()
+ endif()
+ get_target_property(__features "${__target}" ${__property_prefix}QT_${__arg_FEATURE_PROPERTY_INFIX}${__state}_${__visibility}_FEATURES)
+ if("${__features}" STREQUAL "__features-NOTFOUND")
+ continue()
+ endif()
+ foreach(__feature ${__features})
+ set(QT_FEATURE_${__feature} ${__value} PARENT_SCOPE)
+ endforeach()
+ set(__value OFF)
+ endforeach()
+ endforeach()
+ endforeach()
+endfunction()
+
+macro(qt_push_features_into_parent_scope)
+ cmake_parse_arguments(__arg "PUBLIC_FEATURES;PRIVATE_FEATURES" "FEATURE_PROPERTY_INFIX" "" ${ARGN})
+ foreach(__target IN ITEMS ${__arg_UNPARSED_ARGUMENTS})
+ if(NOT TARGET ${__target})
+ continue()
+ endif()
+ get_target_property(__target_type "${__target}" TYPE)
+ if("${__target_type}" STREQUAL "INTERFACE_LIBRARY")
+ set(__property_prefix "INTERFACE_")
+ else()
+ set(__property_prefix "")
+ endif()
+ foreach(__visibility PUBLIC PRIVATE)
+ set(__value ON)
+ foreach(__state ENABLED DISABLED)
+ if(NOT ${__arg_${__visibility}_FEATURES})
+ continue()
+ endif()
+ get_target_property(__features "${__target}" ${__property_prefix}QT_${__arg_FEATURE_PROPERTY_INFIX}${__state}_${__visibility}_FEATURES)
+ if("${__features}" STREQUAL "__features-NOTFOUND")
+ continue()
+ endif()
+ foreach(__feature ${__features})
+ set(QT_FEATURE_${__feature} ${__value} PARENT_SCOPE)
+ endforeach()
+ set(__value OFF)
+ endforeach()
+ endforeach()
+ endforeach()
+endmacro()
+
+macro(qt_load_global_features)
+ if(NOT TARGET Qt::Core)
+ find_package(Qt${PROJECT_VERSION_MAJOR}Core QUIET)
+ endif()
+ qt_pull_features_into_current_scope(PUBLIC_FEATURES PRIVATE_FEATURES FEATURE_PROPERTY_INFIX "GLOBAL_" Qt::Core)
+endmacro()
diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in
new file mode 100644
index 0000000000..32f30fed7e
--- /dev/null
+++ b/cmake/QtModuleConfig.cmake.in
@@ -0,0 +1,9 @@
+@PACKAGE_INIT@
+
+find_package(Qt@PROJECT_VERSION_MAJOR@ QUIET)
+
+include("${CMAKE_CURRENT_LIST_DIR}/@versioned_module_name@Targets.cmake")
+
+if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/@versioned_module_name@Macros.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/@versioned_module_name@Macros.cmake")
+endif()
diff --git a/cmake/QtPlatformSupport.cmake b/cmake/QtPlatformSupport.cmake
new file mode 100644
index 0000000000..4f3103e304
--- /dev/null
+++ b/cmake/QtPlatformSupport.cmake
@@ -0,0 +1,41 @@
+function(set01 result)
+ if (${ARGN})
+ set("${result}" 1 PARENT_SCOPE)
+ else()
+ set("${result}" 0 PARENT_SCOPE)
+ endif()
+endfunction()
+
+set01(LINUX CMAKE_SYSTEM_NAME STREQUAL "Linux")
+set01(HPUX CMAKE_SYSTEM_NAME STREQUAL "HPUX")
+set01(ANDROID CMAKE_SYSTEM_NAME STREQUAL "Android") # FIXME: How to identify this?
+set01(NACL CMAKE_SYSTEM_NAME STREQUAL "NaCl") # FIXME: How to identify this?
+set01(INTEGRITY CMAKE_SYSTEM_NAME STREQUAL "Integrity") # FIXME: How to identify this?
+set01(VXWORKS CMAKE_SYSTEM_NAME STREQUAL "VxWorks") # FIXME: How to identify this?
+set01(QNX CMAKE_SYSTEM_NAME STREQUAL "QNX") # FIXME: How to identify this?
+set01(OPENBSD CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") # FIXME: How to identify this?
+set01(FREEBSD CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # FIXME: How to identify this?
+set01(NETBSD CMAKE_SYSTEM_NAME STREQUAL "NetBSD") # FIXME: How to identify this?
+set01(WASM CMAKE_SYSTEM_NAME STREQUAL "Webassembly") # FIXME: How to identify this?
+
+set01(BSD APPLE OR OPENBSD OR FREEBSD OR NETBSD)
+
+set01(WINRT WIN32 AND CMAKE_VS_PLATFORM_TOOSLET STREQUAL "winrt") # FIXME: How to identify this?
+
+set01(APPLE_OSX APPLE) # FIXME: How to identify this? For now assume that always building for macOS.
+set01(APPLE_UIKIT APPLE AND CMAKE_XCODE_PLATFORM_TOOLSET STREQUAL "uikit") # FIXME: How to identify this?
+set01(APPLE_IOS APPLE AND CMAKE_XCODE_PLATFORM_TOOLSET STREQUAL "ios") # FIXME: How to identify this?
+set01(APPLE_TVOS APPLE AND CMAKE_XCODE_PLATFORM_TOOLSET STREQUAL "tvos") # FIXME: How to identify this?
+set01(APPLE_WATCHOS APPLE AND CMAKE_XCODE_PLATFORM_TOOLSET STREQUAL "watchos") # FIXME: How to identify this?
+
+set01(ANDROID_EMBEDDED ANDROID) # FIXME: How to identify this?
+
+set01(GCC CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+set01(CLANG CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+set01(ICC CMAKE_C_COMPILER MATCHES "icc|icl")
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(QT_64BIT TRUE)
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(QT_32BIT TRUE)
+endif()
diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake
new file mode 100644
index 0000000000..5e563d4c91
--- /dev/null
+++ b/cmake/QtPostProcess.cmake
@@ -0,0 +1,32 @@
+function(qt_internal_write_depends_file target)
+ set(module Qt${target})
+ set(outfile "${PROJECT_BINARY_DIR}/include/${module}/${module}Depends")
+ message("Generate ${outfile}...")
+ set(contents "/* This file was generated by cmake with the info from ${module} target. */\n")
+ string(APPEND contents "#ifdef __cplusplus /* create empty PCH in C mode */\n")
+ foreach (m ${ARGN})
+ string(APPEND contents "# include <Qt${m}/Qt${m}>\n")
+ endforeach()
+ string(APPEND contents "#endif\n")
+
+ file(GENERATE OUTPUT ${outfile} CONTENT ${contents})
+endfunction()
+
+function(qt_internal_create_depends_files)
+ message("Generating depends files for ${KNOWN_QT_MODULES}...")
+ foreach (target ${KNOWN_QT_MODULES})
+ get_target_property(depends "${target}" LINK_LIBRARIES)
+ foreach (dep ${depends})
+ list(FIND KNOWN_QT_MODULES "${dep}" _pos)
+ if (_pos GREATER -1)
+ list(APPEND qtdeps "${dep}")
+ endif()
+ endforeach()
+ get_target_property(hasModuleHeaders "${target}" MODULE_HAS_HEADERS)
+ if (${hasModuleHeaders})
+ qt_internal_write_depends_file("${target}" ${qtdeps})
+ endif()
+ endforeach()
+endfunction()
+
+qt_internal_create_depends_files()
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
new file mode 100644
index 0000000000..11ccc129b4
--- /dev/null
+++ b/cmake/QtSetup.cmake
@@ -0,0 +1,47 @@
+## Force C++ standard, do not fall back, do not use compiler extensions
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+## Position independent code:
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+# Do not relink dependent libraries when no header has changed:
+set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
+
+# Default to hidden visibility for symbols:
+set(CMAKE_C_VISIBILITY_PRESET hidden)
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+
+## Enable testing:
+include(CTest)
+enable_testing()
+
+## Define some constants to check for certain platforms, etc:
+include(QtPlatformSupport)
+
+## add_qt_module and co.:
+include(QtBuild)
+
+## Qt Feature support:
+include(QtFeature)
+
+## Compiler optimization flags:
+include(QtCompilerOptimization)
+
+## Find host tools (if non native):
+set(HOST_QT_TOOLS_DIRECTORY "" CACHE PATH "Directory with Qt host tools.")
+
+if (CMAKE_CROSSCOMPILING AND "x${HOST_QT_TOOLS_DIRECTORY}" STREQUAL "x")
+ message(FATAL_ERROR "You need to set HOST_QT_TOOLS_DIRECTORY for a cross-complile.")
+endif()
+
+## Find syncqt in HOST TOOLS or locally:
+if("x${HOST_QT_TOOLS_DIRECTORY}" STREQUAL "x")
+ set(QT_SYNCQT "${PROJECT_SOURCE_DIR}/bin/syncqt.pl")
+ install(PROGRAMS "${QT_SYNCQT}" DESTINATION "${INSTALL_BINDIR}")
+endif()
+
+## Enable support for sanitizers:
+include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake)
diff --git a/cmake/README.md b/cmake/README.md
new file mode 100644
index 0000000000..6ae8162d80
--- /dev/null
+++ b/cmake/README.md
@@ -0,0 +1,103 @@
+# Status
+
+Initial port is on-going. Some modules of QtBase are ported, incl. some of the platform modules. Most are missing still.
+
+Basic functionality is there (moc, uic, etc.), but documentation, translations, qdbusxml2cpp, etc. are missing.
+
+
+# Intro
+
+The CMake update offers an opportunity to revisit some topics that came up during the last few years.
+
+* The Qt build system does not support building host tools during a cross-compilation run. You need to build a Qt for your host machine first and then use the platform tools from that version. The decision to do this was reached independent of cmake: This does save resources on build machines as the host tools will only get built once.
+
+* 3rd-party dependencies are no longer built as part of Qt. zlib, libpng, etc. from src/3rdparty need
+to be supplied from the outside to the build now. You may find apt-get/brew/etc. useful for this. Otherwise you may consider using vcpkg as in the next section. The decision to remove 3rd party dependencies from Qt repositories was reached independent of the decision to use cmake, we just use the opportunity to implement this decision.
+
+* There is less need for bootstrapping. Only moc and rcc (plus the lesser known tracegen and qfloat16-tables) are linking against the bootstrap Qt library. Everything else can link against the full QtCore. This will include qmake, which is currently missing from a cmake build. This will change: Qmake is supported as a build system for applications *using* Qt going forward and will not go away anytime soon.
+
+* For the time being we try to keep qmake working so that we do not interfere too much with ongoing development.
+
+
+# Building against VCPKG
+
+You may use vcpkg to install dependencies needed to build QtBase.
+
+ * ```git clone -b qt https://github.com/tronical/vcpkg```
+ * Run ```bootstrap-vcpkg.bat``` or ```bootstrap-vcpkg.sh```
+ * Set the ``VCPKG_DEFAULT_TRIPLET`` environment variable to
+ * Linux: ``x64-linux``
+ * Windows: ``qt-x86-windows-static``
+ * Build Qt dependencies: ``vcpkg install zlib pcre2 double-conversion harfbuzz``
+ * When running cmake in qtbase, pass ``-DCMAKE_PREFIX_PATH=/path/to/your/vcpkg/installed/$VCPKG_DEFAULT_TRIPLET`` or ``-DCMAKE_PREFIX_PATH=/path/to/your/vcpkg/installed/%VCPKG_DEFAULT_TRIPLET%`` on Windows.
+
+
+# Building
+
+The basic way of building with cmake is as follows:
+
+```
+ cd {build directory}
+ cmake {path to source directory}
+ cmake --build .
+```
+
+``cmake --build`` is just a simple wrapper around the basic build tool that CMake generated a build system for. It works with any supported build backend supported by cmake, but you can also use the backend build tool directly, e.g. by running ``make`` in this case.
+
+CMake has a ninja backend that works quite well and is noticeably faster than make, so you may want to use that:
+
+```
+ cd {build directory}
+ cmake -GNinja {path to source directory}
+ cmake --build . # ... or ninja ;-)
+```
+
+You can look into the generated ``build.ninja`` file if you're curious and you can also build targets directory such as ``ninja lib/libQt5Core.so``.
+
+When you're done with the build, you may want to install it, using ``ninja install`` or ``make install``. The installation prefix is chosen when running cmake though:
+
+```
+ cd {build directory}
+ cmake -GNinja -DCMAKE_INSTALL_PREFIX=/path/where/to/install {path to source directory}
+ ninja
+ ninja install
+```
+
+You can use ``cmake-gui {path to build directory}`` or ``ccmake {path to build directory}`` to configure the values of individual cmake variables or Qt features. After changing a value, you need to choose the *configure* step (usually several times:-/), followed by the *generate* step (to generate makefiles/ninja files).
+
+# Debugging CMake files
+
+CMake allows specifying the ``--trace`` and ``--trace-expand`` options, which work like ``qmake -d -d``: As the cmake code is evaluated, the values of parameters and variables is shown. This can be a lot of output, so you may want to redirect it to a file.
+
+# Porting Help
+
+We have some python scripts to help with the conversion from qmake to cmake. These scripts can be found in ``utils/cmake``.
+
+## configurejson2cmake.py
+
+This script converts all ``configure.json`` in the Qt repository to ``configure.cmake`` files for use with CMake. We want to generate configure.cmake files for the foreseeable future, so if you need to tweak the generated configure.cmake files, please tweak the generation script instead.
+
+``configurejson2cmake.py`` is run like this: ``util/cmake/configurejson2cmake.py .`` in the top-level source directory of a Qt repository.
+
+
+## pro2cmake.py
+
+``pro2cmake.py`` generates a skeleton CMakeLists.txt file from a .pro-file. You will need to polish the resulting CMakeLists.txt file, but e.g. the list of files, etc. should be extracted for you.
+
+``pro2cmake.py`` is run like this: ``/path/to/pro2cmake.py some.pro``.
+
+
+## run_pro2cmake.py
+
+`` A small helper script to run pro2cmake.py on all .pro-files in a directory. Very useful to e.g. convert all the unit tests for a Qt module over to cmake;-)
+
+``run_pro2cmake.py`` is run like this: ``/path/to/run_pro2cmake.py some_dir``.
+
+
+## How to convert certain constructs
+
+| qmake | CMake |
+| ------ | ------ |
+| ``qtHaveModule(foo)`` | ``if(TARGET Qt::foo)`` |
+| ``qtConfig(foo)`` | ``if (QT_FEATURE_foo)`` |
+
diff --git a/cmake/tests/features/CMakeLists.txt b/cmake/tests/features/CMakeLists.txt
new file mode 100644
index 0000000000..0208e3d890
--- /dev/null
+++ b/cmake/tests/features/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required(VERSION 3.12.0)
+
+project(FeaturesTest
+ VERSION 1.0.0
+ DESCRIPTION "QtFeature test"
+ HOMEPAGE_URL "https://qt.io/"
+ LANGUAGES CXX C
+)
+
+## Add some paths to check for cmake modules:
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../;${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/extra-cmake-modules/find-modules;${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/kwin")
+
+## Qt specific setup common for all modules:
+include(QtSetup)
+
+## Library to hold global features:
+add_library(Qt_global_Config INTERFACE)
+
+qt_feature_module_begin(LIBRARY QtCore
+ PUBLIC_FILE src/corelib/global/qconfig.h
+ PRIVATE_FILE src/corelib/global/qconfig_p.h
+)
+include("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
+qt_feature_module_end(Qt_global_Config)
+
+assert(QT_FEATURE_top_a STREQUAL "ON")
+assert(QT_FEATURE_top_b STREQUAL "OFF")
+assert(QT_FEATURE_top_enabled STREQUAL "ON")
+assert(QT_FEATURE_top_disabled STREQUAL "OFF")
+assert(QT_FEATURE_top_disabled_enabled STREQUAL "OFF")
+assert(NOT DEFINED QT_FEATURE_top_not_emitted)
+
+## Enable feature summary at the end of the configure run:
+include(FeatureSummary)
+
+add_subdirectory(src)
+
+## Delayed actions on some of the Qt targets:
+include(QtPostProcess)
+
+## Print a feature summary:
+feature_summary(WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/cmake/tests/features/configure.cmake b/cmake/tests/features/configure.cmake
new file mode 100644
index 0000000000..ace2b62450
--- /dev/null
+++ b/cmake/tests/features/configure.cmake
@@ -0,0 +1,35 @@
+#### Features
+
+# This belongs into gui, but the license check needs it here already.
+qt_feature("top_a" PRIVATE
+ LABEL "top_a"
+ CONDITION ON
+)
+qt_feature("top_b" PUBLIC PRIVATE
+ LABEL "top_b"
+ AUTODETECT OFF
+)
+qt_feature_definition("top_a" "top_defa")
+
+qt_feature("top_enabled" PRIVATE
+ LABEL "top_enabled"
+ ENABLE ON
+)
+
+qt_feature("top_disabled" PRIVATE
+ LABEL "top_enabled"
+ DISABLE ON
+)
+
+qt_feature("top_disabled_enabled" PRIVATE
+ LABEL "top_enabled_enabled"
+ DISABLE ON
+ ENABLE ON
+)
+
+qt_feature("top_not_emitted" PRIVATE
+ LABEL "top_not_emitted"
+ EMIT_IF OFF
+)
+
+qt_extra_definition("top_extra" "PUBLIC_FOO" PUBLIC)
diff --git a/cmake/tests/features/src/CMakeLists.txt b/cmake/tests/features/src/CMakeLists.txt
new file mode 100644
index 0000000000..1a31dbc8c5
--- /dev/null
+++ b/cmake/tests/features/src/CMakeLists.txt
@@ -0,0 +1,7 @@
+## Features from parent scope were inherited:
+assert(QT_FEATURE_top_a STREQUAL "ON")
+assert(QT_FEATURE_top_b STREQUAL "OFF")
+assert(QT_FEATURE_top_enabled STREQUAL "ON")
+assert(QT_FEATURE_top_disabled STREQUAL "OFF")
+assert(QT_FEATURE_top_disabled_enabled STREQUAL "OFF")
+assert(NOT DEFINED QT_FEATURE_top_not_emitted)