@@ -72,6 +72,29 @@ if (WIN32)
72
72
73
73
elseif (UNIX )
74
74
75
+ # Putting UNIX deployment into a function to be able to safely abort it.
76
+ function (deploy_qt_for_unix )
77
+
78
+ # Check Qt plugins first: if related CMake modules are not available, we should skip everything else here
79
+ # NOTE: For Qt downloaded+installed from their website, the Qt5::Gui component lists all the
80
+ # input, platform, etc. plugins. in Qt5Gui_PLUGINS. On the packaged Qt5 versions (e.g., in
81
+ # Ubuntu 17.10), Qt5Gui_PLUGINS is empty, and no CMake modules are available that would
82
+ # facilitate plugin deployment.
83
+ # TODO: All that stuff could be manually deployed, too. But that's error-prone and hard to maintain.
84
+ set (_allPlugins )
85
+ foreach (_component ${PROJECT_QT_COMPONENTS} )
86
+ list (APPEND _allPlugins ${Qt5${_component}_PLUGINS} )
87
+ endforeach ()
88
+
89
+ if (NOT Qt5::QXcbGlxIntegrationPlugin IN_LIST _allPlugins )
90
+ message (WARNING "Binary deployment if Qt5 plugins is not supported with your Qt \
91
+ installation. If you require a self-contained binary package, consider switching to a manual Qt \
92
+ installation downloaded from https://www1.qt.io/download-open-source/
93
+ See notes in helper-qtdeploy.cmake for details of this problem.
94
+ SKIPPING DEPLOYMENT OF Qt LIBRARIES AND PLUGINS!" )
95
+ return ()
96
+ endif ()
97
+
75
98
# qt.conf: setup deploy folder structure
76
99
install (FILES qt.conf.linux
77
100
DESTINATION ${INSTALL_BIN}
@@ -110,11 +133,6 @@ elseif(UNIX)
110
133
)
111
134
endforeach ()
112
135
113
- set (_allPlugins )
114
- foreach (_component ${PROJECT_QT_COMPONENTS} )
115
- list (APPEND _allPlugins ${Qt5${_component}_PLUGINS} )
116
- endforeach ()
117
-
118
136
# Plugins: copy as is [can't check what is actually needed]
119
137
foreach (_plugin ${_allPlugins} )
120
138
get_target_property (_locationRelease ${_plugin} IMPORTED_LOCATION_RELEASE )
@@ -191,6 +209,10 @@ elseif(UNIX)
191
209
DESTINATION ${INSTALL_SHARED}
192
210
RENAME ${_XcbQpa_pathTruncated}
193
211
)
212
+ endfunction ()
213
+
214
+ deploy_qt_for_unix ()
215
+
194
216
endif ()
195
217
196
218
function (deployQtBinariesForTarget TARGET_NAME )
0 commit comments