[cmake-developers] Qt Bundle Utilities/Packaging

Mike McQuaid mike at mikemcquaid.com
Fri Apr 8 05:56:40 EDT 2011


On 7 April 2011 16:41, Clinton Stimpson <clinton at elemtech.com> wrote:
> I would put it in Qt4Macros.cmake and document it in FindQt4.cmake.

Cool, ok.

> I would love some other people's input in this work.
> I have put some work into it already and can give you the patches I have so
> far.
> When I started 'using' the functions, they didn't work the way I wanted.  So
> what I am hoping for was input on what the CMakeLists.txt files should
> contain... then maybe we can adjust the functions for installing Qt plugins to
> work with that.
>
> Here's a snippet from a CMakeLists.txt file that demonstrates how I wanted to
> be able to call it.  You'll notice how the functions follow the install()
> command style.  There is some of passing the same arguments into each command,
> but at least the caller doesn't have to formulate a different set of arguments
> for each function call.  If there is a totally different way to think about
> this, I'm open to suggestions.
>
> ===========
> function(install_prerequisites  ....)
>  install(CODE "
>  include(BundleUtilities)
>  ....
>  fixup_bundle(\"${app}\" \"${libs}\" \"${dirs}\")
>  "
>  )
> endfunction(install_prerequisites)
>
> include(CPack)
> # install target
> install(TARGETS testqt DESTINATION bin)
> # install Qt plugins in a custom location
> qt4_install_default_plugins(DESTINATION bin/myplugins)
> # install qt.conf file with custom plugin location
> qt4_install_qtconf(DESTINATION bin BUNDLE_DESTIATION . CONTENTS Plugins
> myplugins)
> # install prerequisites  (todo, how to pass installed Qt plugins into this
> function?)
> install_prerequisites(TARGET testqt DESTINATION bin BUNDLE_DESTINATION .
> COMPONENT Runtime)
> ===========
>
> Also, see attached for patch to Qt4Macros.cmake and FindQt4.cmake.

I think we can combine our work here. I guess my thoughts was to make
something even more generic, you just give it an application bundle
and paths to plugins (although you could use plugin names too using
your macros) and it would install them, fix up the package and write
the qt.conf if needed on the platform with the plugin location (e.g.
needed for Mac bundles, not for Windows). It should also know about
all the needed destinations per-platform. I guess I saw my stuff as an
extension to fixup_bundle rather than existing much outside so instead
of fixup_bundle and do_qt_stuff I would just call deploy_qt(app
plugins) and it does the rest automagically.


-- 
Mike McQuaid
http://mikemcquaid.com



More information about the cmake-developers mailing list