summaryrefslogtreecommitdiff
blob: 32d1a0219725e4f98888cdf138905ace285964a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
From 7a9f7e0629aa28ffafc4433bbdf43a011754d7c3 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Wed, 18 Apr 2018 18:53:23 +0200
Subject: [PATCH] Fix build with Qt 5.11_beta3 (dropping qt5_use_modules)

---
 CMakeLists.txt            | 1 -
 cmake/TrojitaOption.cmake | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a882370..781e576b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
 project(trojita)
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
 
-# Qt5's qt5_use_modules need 2.8.9+
 # On win32, we need QtMain linking, which means 2.8.11+
 # EL7 ships 2.8.11, Debian 8 ships 3.0.2, and Ubuntu 14.04 LTS has 2.8.12
 cmake_minimum_required(VERSION 2.8.11)
diff --git a/cmake/TrojitaOption.cmake b/cmake/TrojitaOption.cmake
index ed99e952..8ac6b6be 100644
--- a/cmake/TrojitaOption.cmake
+++ b/cmake/TrojitaOption.cmake
@@ -100,7 +100,7 @@ macro(trojita_add_plugin target type)
     set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS BUILD_PLUGIN)
     target_link_libraries(${target} Plugins)
     if (WITH_QT5)
-        qt5_use_modules(${target} Core)
+        target_link_libraries(${target} Qt5::Core)
     else()
         target_link_libraries(${target} ${QT_QTCORE_LIBRARY})
     endif()
-- 
2.17.0

From 94adf1d2e3e2d4a9e0c59fa9423ae711cf55c6fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jkt@kde.org>
Date: Wed, 19 Oct 2016 21:58:57 +0200
Subject: [PATCH] cmake: do not use qt5_use_modules

...because the documentation suggests going with imported targets and
target_link_libraries.

Change-Id: I403d40d0b0ac8d88cadb011c2c2a643221f15daf
---
 CMakeLists.txt | 42 ++++++++++++++++--------------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92a682f7..f0d395d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -552,13 +552,13 @@ set_source_files_properties(${version_files}
 add_library(Common STATIC ${libCommon_SOURCES})
 set_property(TARGET Common APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 add_dependencies(Common version)
-qt5_use_modules(Common Core Network)
+target_link_libraries(Common Qt5::Network)
 
 add_library(AppVersion STATIC ${libAppVersion_SOURCES})
 set_property(TARGET AppVersion APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 add_dependencies(AppVersion version)
 target_link_libraries(AppVersion Common)
-qt5_use_modules(AppVersion Core)
+target_link_libraries(AppVersion Qt5::Core)
 
 if(WITH_SHARED_PLUGINS)
     add_library(Plugins SHARED ${libPlugins_SOURCES})
@@ -569,12 +569,11 @@ else()
 endif()
 set_target_properties(Plugins PROPERTIES OUTPUT_NAME trojita_plugins)
 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
-qt5_use_modules(Plugins Core)
+target_link_libraries(Plugins Qt5::Core)
 
 add_library(UiUtils STATIC ${libUiUtils_SOURCES})
 set_property(TARGET UiUtils APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
-target_link_libraries(UiUtils Plugins Common)
-qt5_use_modules(UiUtils Core Gui Network)
+target_link_libraries(UiUtils Plugins Common Qt5::Gui)
 
 add_library(Streams STATIC ${libStreams_SOURCES})
 set_property(TARGET Streams APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
@@ -582,36 +581,32 @@ if(WITH_ZLIB)
     set_property(TARGET Streams APPEND PROPERTY INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR})
     target_link_libraries(Streams ${ZLIB_LIBRARIES})
 endif()
-qt5_use_modules(Streams Network)
+target_link_libraries(Streams Qt5::Network)
 
 add_library(IPC STATIC ${libIPC_SOURCES})
 set_property(TARGET IPC APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 if(WITH_DBUS)
-    qt5_use_modules(IPC DBus Widgets)
+    target_link_libraries(IPC Qt5::DBus Qt5::Widgets)
 else()
-    qt5_use_modules(IPC Core)
+    target_link_libraries(IPC Qt5::Core)
 endif()
 
 add_library(qwwsmtpclient STATIC ${libqwwsmtpclient_SOURCES})
-qt5_use_modules(qwwsmtpclient Network)
+target_link_libraries(qwwsmtpclient Qt5::Network)
 
 add_library(MSA STATIC ${libMSA_SOURCES})
 set_property(TARGET MSA APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 target_link_libraries(MSA Imap Streams qwwsmtpclient)
-qt5_use_modules(MSA Network)
 
 add_library(Composer STATIC ${libComposer_SOURCES})
 set_property(TARGET Composer APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 target_link_libraries(Composer Common MSA Streams UiUtils qwwsmtpclient)
-qt5_use_modules(Composer Gui Network)
 
 add_library(Imap STATIC ${libImap_SOURCES})
 set_property(TARGET Imap APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
-target_link_libraries(Imap Common Streams UiUtils)
-qt5_use_modules(Imap Gui Network Sql)
+target_link_libraries(Imap Common Streams UiUtils Qt5::Sql)
 
 add_library(Cryptography STATIC ${libCryptography_SOURCES})
-qt5_use_modules(Cryptography Core)
 set_property(TARGET Cryptography APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 target_link_libraries(Cryptography Common Imap)
 if(WITH_MIMETIC)
@@ -636,8 +631,7 @@ endif()
 ## QtKeyChain plugin
 if(WITH_QTKEYCHAIN_PLUGIN)
     trojita_add_plugin(trojita_plugin_QtKeychainPasswordPlugin WITH_QTKEYCHAIN_PLUGIN src/Plugins/QtKeyChain/QtKeyChainPassword.cpp)
-    qt5_use_modules(trojita_plugin_QtKeychainPasswordPlugin Core DBus)
-    target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin ${QTKEYCHAIN_LIBRARIES})
+    target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin ${QTKEYCHAIN_LIBRARIES} Qt5::DBus)
     set_property(TARGET trojita_plugin_QtKeychainPasswordPlugin APPEND PROPERTY INCLUDE_DIRECTORIES ${QTKEYCHAIN_INCLUDE_DIRS})
 endif()
 
@@ -662,7 +656,7 @@ if(WITH_ABOOKADDRESSBOOK_PLUGIN)
     trojita_add_plugin(trojita_plugin_AbookAddressbookPlugin WITH_ABOOKADDRESSBOOK_PLUGIN ${libAbookAddressbook_SOURCES} ${libAbookAddressbook_UI_OUT})
     set_property(TARGET trojita_plugin_AbookAddressbookPlugin APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
 
-    qt5_use_modules(trojita_plugin_AbookAddressbookPlugin Widgets)
+    target_link_libraries(trojita_plugin_AbookAddressbookPlugin Qt5::Widgets)
 
     set(be_contacts_SOURCES
         ${path_AbookAddressbook}/main.cpp
@@ -675,7 +669,7 @@ if(WITH_ABOOKADDRESSBOOK_PLUGIN)
         set_property(TARGET be.contacts APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN)
         target_link_libraries(be.contacts trojita_plugin_AbookAddressbookPlugin)
     endif()
-    qt5_use_modules(be.contacts Widgets)
+    target_link_libraries(be.contacts Qt5::Widgets)
 endif()
 
 # Generate file static_plugins.h.in
@@ -695,15 +689,13 @@ if(WITH_DESKTOP)
     # The following is needed for the LineEdit widget within the .ui files.
     # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
     set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
-    target_link_libraries(DesktopGui Common UiUtils Composer Cryptography Imap IPC MSA Plugins Streams qwwsmtpclient)
+    target_link_libraries(DesktopGui Common UiUtils Composer Cryptography Imap IPC MSA Plugins Streams qwwsmtpclient Qt5::WebKitWidgets)
 
     # On Windows build a real Win32 GUI application without console window
     # On other platforms WIN32 flag is ignored
     add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM})
     set_property(TARGET trojita APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
     target_link_libraries(trojita AppVersion Common UiUtils DesktopGui ${STATIC_PLUGINS})
-    qt5_use_modules(DesktopGui Network WebKitWidgets)
-    qt5_use_modules(trojita Widgets Network)
 endif()
 
 
@@ -737,17 +729,15 @@ if(WITH_TESTS)
         tests/Utils/LibMailboxSync.cpp
     )
     add_library(test_LibMailboxSync STATIC ${test_LibMailboxSync_SOURCES})
-    qt5_use_modules(test_LibMailboxSync Test Network)
     set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
         ${CMAKE_CURRENT_SOURCE_DIR}/tests
         ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils)
-    target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer)
+    target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer Qt5::Test)
 
     macro(trojita_test dir fname)
         set(test_${fname}_SOURCES tests/${dir}/test_${fname}.cpp)
         add_executable(test_${fname} ${test_${fname}_SOURCES})
         target_link_libraries(test_${fname} Imap MSA Streams Common Composer Cryptography test_LibMailboxSync)
-        qt5_use_modules(test_${fname} Network Sql Test Widgets)
         set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
         if(NOT CMAKE_CROSSCOMPILING)
             add_test(test_${fname} test_${fname})
@@ -759,9 +749,9 @@ if(WITH_TESTS)
     enable_testing()
     trojita_test(Composer Composer_Submission)
     trojita_test(Composer Composer_responses)
+    target_link_libraries(test_Composer_responses Qt5::WebKitWidgets)
     trojita_test(Composer Html_formatting)
-    qt5_use_modules(test_Composer_responses WebKitWidgets)
-    qt5_use_modules(test_Html_formatting WebKitWidgets)
+    target_link_libraries(test_Html_formatting Qt5::WebKitWidgets)
     trojita_test(Imap Imap_DisappearingMailboxes)
     trojita_test(Imap Imap_Idle)
     trojita_test(Imap Imap_LowLevelParser)
-- 
2.17.0