[CMake] How to package for Debian with Qt dependencies

Andreas Pakulat apaku at gmx.de
Tue Apr 10 07:14:34 EDT 2012


On 10.04.12 13:01:23, Carlo Nicolini wrote:
> I've started a Qt project with CMake and until now is very successfull but
> I'm wondering how to package my program for use with debian with the
> correct dependencies
> 
> In the main CMakeLists.txt I have:
> 
>         set (CPACK_GENERATOR "DEB")
>         set (${VERSION} CPACK_DEBIAN_PACKAGE_VERSION)
>         set (CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
>         set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
>         set (CPACK_PACKAGE_FILE_NAME
> "${CMAKE_PROJECT_NAME}_${FOOBARVERSION}_${LICENSE_TYPE}_${CPACK_DEBIAN_ARCHITECTURE}")
>         SET(CPACK_PACKAGE_EXECUTABLES "FOOBAR" "FOOBAR
> (v${FOOBAR_MAJOR}.${FOOBAR_MINOR}.${FOOBAR_PATCH})")
> 
> and in the CMakeLists.txt related to the executable itself
> 
> if (UNIX AND NOT APPLE)
> add_executable(Foobar ${ALL_THE_NEEDED_FILES} )
> target_link_libraries(Foobar ${QT_LIBRARIES} Common GL GLU glut)
> 
> INSTALL(TARGETS Foobar DESTINATION Foobar)
> endif (UNIX AND NOT APPLE)
> 
> The debian package is created correctly but once in a clean test virtual
> machine, I try to run it, the dpkg installer complains saying that *
> freeglut3* dependencies are not satisfiable*.*
> *Dependency is not satisfiable: freeglut3*

Did you list freeglut3 on the commandline when you installed your .deb?
dpkg is the low-level tool for installing packages, it'll barf at you if
you give it a .deb and not all of the dependencies of it are installed
yet and also not listed on the commandline. So either you need to do 

dpkg -i foo.deb freeglut3 <all other dependencies not yet installed> 

or install the dependencies before installing your .deb.

If you want this to work automatically you'll have to look into creating
an APT repository with the corresponding package list and directory
structure. This is something that CMake cannot do for you at the moment.

Andreas



More information about the CMake mailing list