[CMake] Bundling Qt5 with CMake on Linux

Michael Jackson mike.jackson at bluequartz.net
Mon Oct 8 09:04:59 EDT 2018


I think we ended up doing a lot of "if Qt version is X and System is Y) then install Z" inside of our CMake codes. We abstracted out the Qt library names so we just make lists of the libraries, plugins and system specific binaries that are needed then the CMake code creates install rules to place them into the proper location. Not neat, not clean but works for us.

--
Michael Jackson | Owner, President
      BlueQuartz Software
[e] mike.jackson at bluequartz.net
[w] www.bluequartz.net <http://www.bluequartz.net>

On 10/8/18, 6:44 AM, "CMake on behalf of Andreas Pakulat" <cmake-bounces at cmake.org on behalf of apaku at gmx.de> wrote:

    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
    -- 
    
    Powered by www.kitware.com
    
    Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
    
    Kitware offers various services to support the CMake community. For more information on each offering, please visit:
    
    CMake Support: http://cmake.org/cmake/help/support.html
    CMake Consulting: http://cmake.org/cmake/help/consulting.html
    CMake Training Courses: http://cmake.org/cmake/help/training.html
    
    Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
    
    Follow this link to subscribe/unsubscribe:
    https://cmake.org/mailman/listinfo/cmake
    




More information about the CMake mailing list