[CMake] Bundling Qt5 with CMake on Linux

Andreas Pakulat apaku at gmx.de
Mon Oct 8 06:39:08 EDT 2018


Hi,

I'm currently trying to find a good approach to bundling Qt5 with my
application on Linux using CMake (and CPack to create tar.gz). It
appears this topic isn't covered very well - or I'm using the wrong
search keywords.

What I have right now is copying the different plugins that are needed
by the application into the install directory, then run fixup_bundle
over the executable passing the Qt library directory and the plugins
in the install location. In addition to that a qt.conf is written. Now
this has a few problems:

- BundleUtilities decides to put the qt libraries into the bin/ folder
where the executable is, that requires a more complicated qt.conf
since the location of plugins and libraries relative to one another is
not the same as in the Qt installation directory
- BundleUtilities decides to strip rpath and runpath from the copied
libraries, this is a major problem since the Qt libraries depend on
icu-libraries which are not found anymore without the runpath they
have originally ($ORIGIN)

It appears both of these are not configurable which makes me wonder if
anybody here is using BundleUtilities at all on Linux for bundling
Qt5. If not, what are you using instead?

I could live with the libraries in the bin/ folder instead of the lib/
folder but the second point is a problem.

I shortly looked at the linuxdeployqt project
(https://github.com/probonopd/linuxdeployqt) but that only helps when
wanting to ship an AppImage or AppDir, but since I'm looking at
creating a package from a couple of binaries all using Qt that's not
an option either.

Andreas


More information about the CMake mailing list