[CMake] CPack and fixup_bundle

Tyler tyler at cryptio.net
Fri Mar 18 02:44:33 EDT 2011


It's a little obtuse but you need to use \${CMAKE_INSTALL_PREFIX} in that
first argument to fixup_bundle(). If you don't, ${CMAKE_INSTALL_PREFIX} will
be evaluated at CMake-time and therefore point to your build-time install
directory. You want to delay evaluation of that variable until CPack time,
when it will evaluate to the install directory that CPack uses.

If it makes you feel any better, it took me and another developer quite a
while to figure this out in our own project :).

Take a look at the ${CMAKE_BINARY_DIR}/cmake_install.cmake generated for
your project to see what I mean.

hth,
tyler

On Thu, Mar 17, 2011 at 2:14 PM, Simon Drouin <drouin.simon at gmail.com>wrote:

> I'm trying to use CPack to create a .tar.gz package on linux. I use
> fixup_bundle from the bundle utility to copy and fix Qt libraries to the
> bundle.
>
> When I use simple 'make install', everything is installed properly in
> directory specified by CMAKE_INSTALL_PREFIX. When I use CPack, the Qt
> libraries are still copied to the CMAKE_INSTALL_PREFIX directory and not the
> package's directory. Here's the code:
>
>   # install executable(s)
>
> install( TARGETS ${exec_name} DESTINATION . )
>
>
>  # fixup the bundle
>
> set( APPS ${CMAKE_INSTALL_PREFIX}/${exec_name} )
>
> list( APPEND libSearchDirs ${QT_LIBRARY_DIR})
>
> set( additionalLib ${qtsvgiconplugin} )
>
> INSTALL(CODE "include(BundleUtilities)
>
>     fixup_bundle(\"${APPS}\" \"${additionalLib}\" \"${libSearchDirs}\")" COMPONENT Runtime)
>
>
>  #================================
>
> # Packaging
>
> #================================
>
> set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "My test package")
>
> set( CPACK_PACKAGE_NAME ${exec_name} )
>
> set( CPACK_PACKAGE_CONTACT "John Smith")
>
> set( CPACK_PACKAGE_VENDOR "Company inc.")
>
> set( CPACK_PACKAGE_VERSION_MAJOR ${PROG_MAJOR_VERSION})
>
> set( CPACK_PACKAGE_VERSION_MINOR ${PROG_MINOR_VERSION})
>
> set( CPACK_PACKAGE_VERSION_PATCH ${PROG_PATCH_VERSION})
>
> set( CPACK_GENERATOR "TGZ")
>
> set( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CMAKE_SYSTEM_PROCESSOR}")
>
> include(CPack)
>
>
> Am I missing something?
>
>
> s.
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110317/22b8f0e5/attachment.htm>


More information about the CMake mailing list