db-move: moved polari from [testing] to [extra] (x86_64)
[arch-packages.git] / libdbusmenu-qt / repos / extra-x86_64 / libdbusmenu-qt6-cmake.patch
blob1fba3af4910c432b1a4c44a00b5f64d51937b2fb
1 diff --git a/CMakeLists.txt b/CMakeLists.txt
2 index 72cbc45..15b3ffe 100644
3 --- a/CMakeLists.txt
4 +++ b/CMakeLists.txt
5 @@ -25,7 +25,7 @@ set(dbusmenu_qt_lib_PATCH_VERSION 0)
6 set(dbusmenu_qt_lib_VERSION ${dbusmenu_qt_lib_SOVERSION}.${dbusmenu_qt_lib_API_VERSION}.${dbusmenu_qt_lib_PATCH_VERSION})
8 # Check if we want to explicitly select the Qt version to be used or autodetect
9 -if (NOT USE_QT4 AND NOT USE_QT5)
10 +if (NOT USE_QT4 AND NOT USE_QT5 AND NOT USE_QT6)
11 # Autodetect, prefering Qt5
12 message(STATUS "Autodetecting Qt version to use")
13 find_package(Qt5Widgets QUIET)
14 @@ -35,7 +35,15 @@ if (NOT USE_QT4 AND NOT USE_QT5)
15 endif()
17 # Detect for which Qt version we're building
18 -if (USE_QT5)
19 +if (USE_QT6)
20 + find_package(Qt6 REQUIRED COMPONENTS Core Widgets DBus)
21 + include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
22 + set(CMAKE_AUTOMOC ON)
23 + set(CMAKE_AUTOMOC_RELAXED_MODE ON)
24 + set(CMAKE_POSITION_INDEPENDENT_CODE ON)
26 + set(QT_SUFFIX "qt6")
27 +elseif (USE_QT5)
28 find_package(Qt5Widgets REQUIRED)
29 find_package(Qt5DBus REQUIRED)
30 include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
31 @@ -69,9 +77,9 @@ if (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL)
32 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
33 endif (__DBUSMENU_HAVE_W_OVERLOADED_VIRTUAL)
35 -check_cxx_compiler_flag(-std=c++11 __DBUSMENU_HAVE_CXX11)
36 +check_cxx_compiler_flag(-std=c++17 __DBUSMENU_HAVE_CXX11)
37 if (__DBUSMENU_HAVE_CXX11)
38 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
39 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
40 endif (__DBUSMENU_HAVE_CXX11)
42 include(CMakePackageConfigHelpers)
43 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
44 index 2c4a4e8..e99d24a 100644
45 --- a/src/CMakeLists.txt
46 +++ b/src/CMakeLists.txt
47 @@ -21,20 +21,23 @@ if (__DBUSMENU_HAVE_W_ALL)
48 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
49 endif (__DBUSMENU_HAVE_W_ALL)
51 -check_cxx_compiler_flag(-std=c++11 __DBUSMENU_HAVE_CXX11)
52 +check_cxx_compiler_flag(-std=c++17 __DBUSMENU_HAVE_CXX11)
53 if (__DBUSMENU_HAVE_CXX11)
54 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
55 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
56 endif (__DBUSMENU_HAVE_CXX11)
58 # Check whether QIcon::name() exists. It was added in late Qt 4.7 cycle, and is
59 # not present in betas.
61 -if (NOT USE_QT5)
62 +if (NOT USE_QT5 AND NOT USE_QT6)
63 set(CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}")
64 set(CMAKE_REQUIRED_LIBRARIES "${QT_QTGUI_LIBRARIES};${QT_QTCORE_LIBRARIES}")
65 -else()
66 +elseif(USE_QT5)
67 set(CMAKE_REQUIRED_INCLUDES "${Qt5Gui_INCLUDE_DIRS};${Qt5Core_INCLUDE_DIRS}")
68 set(CMAKE_REQUIRED_LIBRARIES "${Qt5Gui_LIBRARIES};${Qt5Core_LIBRARIES}")
69 +else()
70 + set(CMAKE_REQUIRED_INCLUDES "${Qt6Gui_INCLUDE_DIRS};${Qt6Core_INCLUDE_DIRS}")
71 + set(CMAKE_REQUIRED_LIBRARIES "${Qt6Gui_LIBRARIES};${Qt6Core_LIBRARIES}")
72 endif()
73 check_cxx_source_compiles("
74 #include <QtGui/QIcon>
75 @@ -64,17 +67,22 @@ include_directories(
76 ${CMAKE_BINARY_DIR}/src
79 -if (NOT USE_QT5)
80 +if (NOT USE_QT5 AND NOT USE_QT6)
81 qt4_automoc(${dbusmenu_qt_SRCS})
82 qt4_add_dbus_adaptor(dbusmenu_qt_SRCS
83 ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.dbusmenu.xml
84 ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus
86 -else()
87 +elseif(USE_QT5)
88 qt5_add_dbus_adaptor(dbusmenu_qt_SRCS
89 ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.dbusmenu.xml
90 ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus
92 +else()
93 + qt6_add_dbus_adaptor(dbusmenu_qt_SRCS
94 + ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.dbusmenu.xml
95 + ${CMAKE_CURRENT_SOURCE_DIR}/dbusmenuexporterdbus_p.h DBusMenuExporterDBus
96 + )
97 endif()
99 configure_file(dbusmenu_version.h.in
100 @@ -88,7 +96,7 @@ set_target_properties(dbusmenu-${QT_SUFFIX} PROPERTIES
104 -if (NOT USE_QT5)
105 +if (NOT USE_QT5 AND NOT USE_QT6)
106 target_link_libraries(dbusmenu-${QT_SUFFIX}
107 ${QT_QTGUI_LIBRARIES}
108 ${QT_QTDBUS_LIBRARIES}
109 @@ -96,10 +104,10 @@ if (NOT USE_QT5)
111 else()
112 target_link_libraries(dbusmenu-${QT_SUFFIX}
113 - ${Qt5Gui_LIBRARIES}
114 - ${Qt5Core_LIBRARIES}
115 - ${Qt5DBus_LIBRARIES}
116 - ${Qt5Widgets_LIBRARIES}
117 + Qt::Gui
118 + Qt::Core
119 + Qt::DBus
120 + Qt::Widgets
122 endif()
124 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
125 index 6be27f5..4f21cb7 100644
126 --- a/tests/CMakeLists.txt
127 +++ b/tests/CMakeLists.txt
128 @@ -1,9 +1,9 @@
129 -if (NOT USE_QT5)
130 +if (NOT USE_QT5 AND NOT USE_QT6)
131 qt4_automoc(slowmenu.cpp)
132 endif()
133 add_executable(slowmenu slowmenu.cpp)
135 -if (NOT USE_QT5)
136 +if (NOT USE_QT5 AND NOT USE_QT6)
137 target_link_libraries(slowmenu
138 ${QT_QTGUI_LIBRARIES}
139 ${QT_QTDBUS_LIBRARIES}
140 @@ -26,7 +26,7 @@ if (NOT USE_QT5)
141 ${QT_QTTEST_INCLUDE_DIR}
142 ${QT_QTDBUS_INCLUDE_DIR}
144 -else()
145 +elseif(USE_QT5)
146 find_package(Qt5Test REQUIRED)
148 target_link_libraries(slowmenu
149 @@ -51,6 +51,31 @@ else()
150 ${Qt5Test_INCLUDE_DIRS}
151 ${Qt5DBus_INCLUDE_DIRS}
153 +else()
154 + find_package(Qt6Test REQUIRED)
156 + target_link_libraries(slowmenu
157 + ${Qt6Gui_LIBRARIES}
158 + ${Qt6Core_LIBRARIES}
159 + ${Qt6DBus_LIBRARIES}
160 + dbusmenu-qt6
163 + set(test_LIBRARIES
164 + ${Qt6Gui_LIBRARIES}
165 + ${Qt6Core_LIBRARIES}
166 + ${Qt6DBus_LIBRARIES}
167 + ${Qt6Test_LIBRARIES}
168 + dbusmenu-qt6
171 + include_directories(
172 + ${CMAKE_CURRENT_SOURCE_DIR}/../src
173 + ${CMAKE_CURRENT_BINARY_DIR}/../src
174 + ${CMAKE_CURRENT_BINARY_DIR}
175 + ${Qt6Test_INCLUDE_DIRS}
176 + ${Qt6DBus_INCLUDE_DIRS}
178 endif()
180 # Macros to create "check" target
181 @@ -77,7 +102,7 @@ set(dbusmenuexportertest_SRCS
182 testutils.cpp
185 -if (NOT USE_QT5)
186 +if (NOT USE_QT5 AND NOT USE_QT6)
187 qt4_automoc(${dbusmenuexportertest_SRCS})
188 endif()
190 @@ -94,7 +119,7 @@ set(dbusmenuimportertest_SRCS
191 testutils.cpp
194 -if (NOT USE_QT5)
195 +if (NOT USE_QT5 AND NOT USE_QT6)
196 qt4_automoc(${dbusmenuimportertest_SRCS})
197 endif()
199 @@ -110,7 +135,7 @@ set(dbusmenushortcuttest_SRCS
200 dbusmenushortcuttest.cpp
203 -if (NOT USE_QT5)
204 +if (NOT USE_QT5 AND NOT USE_QT6)
205 qt4_automoc(${dbusmenushortcuttest_SRCS})
206 endif()