[CMake] DeployQt4 and make package

Daniel Franke franke.daniel at gmail.com
Fri Apr 13 15:04:29 EDT 2012


On Friday 13 April 2012 20:21:39 Daniel Franke wrote:
> Consider:
>   include (GNUInstallDirs)
>   set (PREFIX $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
>   file (GLOB PLUGINS "${QT_PLUGINS_DIR}/imageformats/*.dll")
>   install (CODE "include(DeployQt4)
>                  FIXUP_QT4_EXECUTABLE (\"${PREFIX}/${ARGV0}.exe\"
>                                        \"${PLUGINS}\"
>                                        \"\"
>                                        \"${PREFIX}\"
>                                        \"${PREFIX}/plugins\")")
> 
> This installs the dependencies is in the install location. Ok. But how do I
> need to change this so that PREFIX points to the correct path in
> _CPackPackages/.../bin as one has to pass the actual location of the binary?

The simple solution is: set PREFIX within the INSTALL(CODE) and that's it:

  install (CODE "include(DeployQt4)
                 set (PREFIX 
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
                 FIXUP_QT4_EXECUTABLE (\"\${PREFIX}/${ARGV0}.exe\"
                                       \"${PLUGINS}\"
                                       \"\"
                                       \"\${PREFIX}\"
                                       \"\${PREFIX}/plugins\")")

Note the additional '\' to evaluate the PREFIX variable at runtime, not 
configure time. Meh.

Cheers

	Daniel



More information about the CMake mailing list