backport CMake-Restore-qt5_use_modules-function.patch
This commit is contained in:
parent
356f136cff
commit
664255d3bd
226
0217-CMake-Restore-qt5_use_modules-function.patch
Normal file
226
0217-CMake-Restore-qt5_use_modules-function.patch
Normal file
@ -0,0 +1,226 @@
|
||||
From a834b4d24582ef318ea1de51b6707e9605e6c52f Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Funk <kevin.funk@kdab.com>
|
||||
Date: Thu, 14 Jun 2018 14:50:39 +0200
|
||||
Subject: [PATCH 217/219] CMake: Restore qt5_use_modules() function
|
||||
|
||||
It appears that in the 5 years since we deprecated this function, people
|
||||
have not stopped using it. The removal of qt5_use_modules() caused lots of
|
||||
troubles in packages still using it when they were compiled against Qt 5.11.0.
|
||||
|
||||
Instead, let's revive this function and keep it for the Qt5 life time.
|
||||
|
||||
See discussion on qt-development mailing list:
|
||||
http://lists.qt-project.org/pipermail/development/2018-June/032837.html
|
||||
|
||||
Change-Id: Ic263e3bb6706268cb9ea38a0711665f166a3aa9e
|
||||
Reviewed-by: David Faure <david.faure@kdab.com>
|
||||
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
||||
---
|
||||
src/corelib/Qt5CoreMacros.cmake | 51 +++++++++++++++++++
|
||||
tests/auto/cmake/CMakeLists.txt | 1 +
|
||||
.../test_use_modules_function/CMakeLists.txt | 18 +++++++
|
||||
.../cmake/test_use_modules_function/three.cpp | 45 ++++++++++++++++
|
||||
.../cmake/test_use_modules_function/two.cpp | 43 ++++++++++++++++
|
||||
5 files changed, 158 insertions(+)
|
||||
create mode 100644 tests/auto/cmake/test_use_modules_function/CMakeLists.txt
|
||||
create mode 100644 tests/auto/cmake/test_use_modules_function/three.cpp
|
||||
create mode 100644 tests/auto/cmake/test_use_modules_function/two.cpp
|
||||
|
||||
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
|
||||
index 1627de4002..819b48f973 100644
|
||||
--- a/src/corelib/Qt5CoreMacros.cmake
|
||||
+++ b/src/corelib/Qt5CoreMacros.cmake
|
||||
@@ -294,3 +294,54 @@ function(QT5_ADD_RESOURCES outfiles )
|
||||
endfunction()
|
||||
|
||||
set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
+
|
||||
+if (NOT CMAKE_VERSION VERSION_LESS 2.8.9)
|
||||
+ macro(qt5_use_modules _target _link_type)
|
||||
+ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
|
||||
+ if(CMAKE_WARN_DEPRECATED)
|
||||
+ set(messageType WARNING)
|
||||
+ endif()
|
||||
+ if(CMAKE_ERROR_DEPRECATED)
|
||||
+ set(messageType FATAL_ERROR)
|
||||
+ endif()
|
||||
+ if(messageType)
|
||||
+ message(${messageType} "The qt5_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.")
|
||||
+ endif()
|
||||
+ endif()
|
||||
+
|
||||
+ if (NOT TARGET ${_target})
|
||||
+ message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.")
|
||||
+ endif()
|
||||
+ if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" )
|
||||
+ set(_qt5_modules ${ARGN})
|
||||
+ set(_qt5_link_type ${_link_type})
|
||||
+ else()
|
||||
+ set(_qt5_modules ${_link_type} ${ARGN})
|
||||
+ endif()
|
||||
+
|
||||
+ if ("${_qt5_modules}" STREQUAL "")
|
||||
+ message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.")
|
||||
+ endif()
|
||||
+
|
||||
+ foreach(_module ${_qt5_modules})
|
||||
+ if (NOT Qt5${_module}_FOUND)
|
||||
+ find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH)
|
||||
+ if (NOT Qt5${_module}_FOUND)
|
||||
+ message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
|
||||
+ endif()
|
||||
+ endif()
|
||||
+ target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES})
|
||||
+ set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS})
|
||||
+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS})
|
||||
+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
|
||||
+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
|
||||
+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
|
||||
+ if (Qt5_POSITION_INDEPENDENT_CODE
|
||||
+ AND (CMAKE_VERSION VERSION_LESS 2.8.12
|
||||
+ AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
||||
+ OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)))
|
||||
+ set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
|
||||
+ endif()
|
||||
+ endforeach()
|
||||
+ endmacro()
|
||||
+endif()
|
||||
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
|
||||
index f1d8657091..ec75ec7caf 100644
|
||||
--- a/tests/auto/cmake/CMakeLists.txt
|
||||
+++ b/tests/auto/cmake/CMakeLists.txt
|
||||
@@ -47,6 +47,7 @@ find_package(Qt5Core REQUIRED)
|
||||
|
||||
include("${_Qt5CTestMacros}")
|
||||
|
||||
+expect_pass(test_use_modules_function)
|
||||
expect_pass(test_umbrella_config)
|
||||
expect_pass(test_wrap_cpp_and_resources)
|
||||
if (NOT NO_WIDGETS)
|
||||
diff --git a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000000..be05c75054
|
||||
--- /dev/null
|
||||
+++ b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
|
||||
@@ -0,0 +1,18 @@
|
||||
+
|
||||
+cmake_minimum_required(VERSION 2.8)
|
||||
+
|
||||
+project(test_use_modules_function)
|
||||
+
|
||||
+set(CMAKE_AUTOMOC ON)
|
||||
+
|
||||
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
+
|
||||
+add_executable(two two.cpp)
|
||||
+add_executable(three three.cpp)
|
||||
+
|
||||
+find_package(Qt5Core)
|
||||
+
|
||||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
|
||||
+
|
||||
+qt5_use_modules(two Test)
|
||||
+qt5_use_modules(three Gui Test)
|
||||
diff --git a/tests/auto/cmake/test_use_modules_function/three.cpp b/tests/auto/cmake/test_use_modules_function/three.cpp
|
||||
new file mode 100644
|
||||
index 0000000000..507cc8479d
|
||||
--- /dev/null
|
||||
+++ b/tests/auto/cmake/test_use_modules_function/three.cpp
|
||||
@@ -0,0 +1,45 @@
|
||||
+/****************************************************************************
|
||||
+**
|
||||
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
+** Contact: https://www.qt.io/licensing/
|
||||
+**
|
||||
+** This file is part of the test suite of the Qt Toolkit.
|
||||
+**
|
||||
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
+** Commercial License Usage
|
||||
+** Licensees holding valid commercial Qt licenses may use this file in
|
||||
+** accordance with the commercial license agreement provided with the
|
||||
+** Software or, alternatively, in accordance with the terms contained in
|
||||
+** a written agreement between you and The Qt Company. For licensing terms
|
||||
+** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
+** information use the contact form at https://www.qt.io/contact-us.
|
||||
+**
|
||||
+** GNU General Public License Usage
|
||||
+** Alternatively, this file may be used under the terms of the GNU
|
||||
+** General Public License version 3 as published by the Free Software
|
||||
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
+** included in the packaging of this file. Please review the following
|
||||
+** information to ensure the GNU General Public License requirements will
|
||||
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
+**
|
||||
+** $QT_END_LICENSE$
|
||||
+**
|
||||
+****************************************************************************/
|
||||
+
|
||||
+#include <QtTest>
|
||||
+#include <QWindow>
|
||||
+
|
||||
+class Three : public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ Three(QObject *parent = 0)
|
||||
+ {
|
||||
+ QWindow *w = new QWindow;
|
||||
+ w->show();
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+QTEST_MAIN(Three)
|
||||
+
|
||||
+#include "three.moc"
|
||||
diff --git a/tests/auto/cmake/test_use_modules_function/two.cpp b/tests/auto/cmake/test_use_modules_function/two.cpp
|
||||
new file mode 100644
|
||||
index 0000000000..44eb7fe96e
|
||||
--- /dev/null
|
||||
+++ b/tests/auto/cmake/test_use_modules_function/two.cpp
|
||||
@@ -0,0 +1,43 @@
|
||||
+/****************************************************************************
|
||||
+**
|
||||
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
+** Contact: https://www.qt.io/licensing/
|
||||
+**
|
||||
+** This file is part of the test suite of the Qt Toolkit.
|
||||
+**
|
||||
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
+** Commercial License Usage
|
||||
+** Licensees holding valid commercial Qt licenses may use this file in
|
||||
+** accordance with the commercial license agreement provided with the
|
||||
+** Software or, alternatively, in accordance with the terms contained in
|
||||
+** a written agreement between you and The Qt Company. For licensing terms
|
||||
+** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
+** information use the contact form at https://www.qt.io/contact-us.
|
||||
+**
|
||||
+** GNU General Public License Usage
|
||||
+** Alternatively, this file may be used under the terms of the GNU
|
||||
+** General Public License version 3 as published by the Free Software
|
||||
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
+** included in the packaging of this file. Please review the following
|
||||
+** information to ensure the GNU General Public License requirements will
|
||||
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
+**
|
||||
+** $QT_END_LICENSE$
|
||||
+**
|
||||
+****************************************************************************/
|
||||
+
|
||||
+#include <QtTest>
|
||||
+
|
||||
+class Two : public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ Two(QObject *parent = 0)
|
||||
+ {
|
||||
+
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+QTEST_MAIN(Two)
|
||||
+
|
||||
+#include "two.moc"
|
||||
--
|
||||
2.17.1
|
||||
|
@ -40,7 +40,7 @@ BuildRequires: pkgconfig(libsystemd)
|
||||
Name: qt5-qtbase
|
||||
Summary: Qt5 - QtBase components
|
||||
Version: 5.11.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
|
||||
# See LGPL_EXCEPTIONS.txt, for exception details
|
||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||
@ -89,13 +89,6 @@ Patch51: qtbase-hidpi_scale_at_192.patch
|
||||
# 2. Workaround sysmacros.h (pre)defining major/minor a breaking stuff
|
||||
Patch52: qtbase-opensource-src-5.7.1-moc_macros.patch
|
||||
|
||||
# QMimeType: remove unwanted *.bin as preferredSuffix for octet-stream
|
||||
# This leads to an automatically appended .bin when saving a file.
|
||||
# https://bugs.freedesktop.org/show_bug.cgi?id=101667
|
||||
# https://bugs.kde.org/382437
|
||||
# Fixed upstream in shared-mime-info 1.10
|
||||
Patch53: qtbase-fdo101667.patch
|
||||
|
||||
# respect QMAKE_LFLAGS_RELEASE when building qmake
|
||||
Patch54: qtbase-qmake_LFLAGS.patch
|
||||
|
||||
@ -113,6 +106,9 @@ Patch65: qtbase-opensource-src-5.9.0-mysql.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1497564
|
||||
Patch67: https://bugreports.qt.io/secure/attachment/66353/xcberror_filter.patch
|
||||
|
||||
## upstream patches
|
||||
Patch217: 0217-CMake-Restore-qt5_use_modules-function.patch
|
||||
|
||||
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
|
||||
# Those themes are there for platform integration. If the required libraries are
|
||||
# not there, the platform to integrate with isn't either. Then Qt will just
|
||||
@ -344,14 +340,15 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
||||
%setup -q -n %{qt_module}-everywhere-src-%{version}
|
||||
|
||||
## upstream fixes
|
||||
|
||||
|
||||
|
||||
%patch4 -p1 -b .QTBUG-35459
|
||||
%patch8 -p1 -b .tell-the-truth-about-private-api
|
||||
|
||||
%patch50 -p1 -b .QT_VERSION_CHECK
|
||||
%patch51 -p1 -b .hidpi_scale_at_192
|
||||
%patch52 -p1 -b .moc_macros
|
||||
# FIXME/REBASE ?
|
||||
#patch53 -p1 -b .fdo101667
|
||||
%patch54 -p1 -b .qmake_LFLAGS
|
||||
%patch61 -p1 -b .qt5-qtbase-cxxflag
|
||||
%patch64 -p1 -b .firebird
|
||||
@ -361,6 +358,9 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
||||
# FIXME/REBASE
|
||||
#patch67 -p1 -b .xcberror_filter
|
||||
|
||||
## upstream patches
|
||||
%patch217 -p1 -b .0217
|
||||
|
||||
# move some bundled libs to ensure they're not accidentally used
|
||||
pushd src/3rdparty
|
||||
mkdir UNUSED
|
||||
@ -967,6 +967,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 18 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.11.0-3
|
||||
- backport CMake-Restore-qt5_use_modules-function.patch
|
||||
|
||||
* Wed May 30 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.11.0-2
|
||||
- move libQt5EglFSDeviceIntegration to -gui (#1557223)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user