[CMake] Better handling of library dependencies for CPack

Rosen Diankov rosen.diankov at gmail.com
Fri Apr 22 11:58:25 EDT 2011


Hi Eric,

Before I start running things, basically the script sets
CPACK_DEBIAN_PACKAGE_DEPENDS right? What does this effect have on
cpack?

Also, If we're generating debian source packages, i'm not sure if it
is a good idea to set DISTRO_CODENAME, DISTRO_RELEASE, AND DISTRO_ID
inside the cmake environment. Ideally it should be possible to
generate the source packages for all distributions on the same OS.

I guess this is where the philosophical arguments would start: is it
really necessary for cmake/cpack to generate source debs for a
different distribution than the one it is currently running on ;0)

i would say yes. Even if it is possible to set up chroot environments
for N OSes, the sourcecode files would have to be sent N times,
whereas they only need to be sent once...

Also, you can do

lsb_release -is
lsb_release -rs
lsb_release -cs

to get the names directly without regex.

rosen,

2011/4/23 Eric Noulard <eric.noulard at gmail.com>:
> 2011/4/22 Rosen Diankov <rosen.diankov at gmail.com>:
>> Hi Guys,
>>
>> You are right about shlibdeps, but this is not the whole story.
>>
>> Debian source packages required "build dependencies" to be
>> preinstalled before cmake even runs. This tells each distribution what
>> it needs so that cmake can find it with find_package.
>
> Yes off course build dependencies may be distribution specific and
> may not be found with executable/lib dep.
>
>> Afterwards, it isn't necessary to specify all the dependencies since
>> they can be extracted from the symbols of the shared objects
>> (dpkg-shlibdeps). However, there are cases where the symbols are not
>> used, but it is still required.
>>
>> For example, I have a program that generates c++ files once it is
>> called. This program requires g++ to be present, or otherwise it will
>> not work. Therefore g++ is a runtime dependency, but there are no g++
>> symbols in the program.
>
> yes ok too.
> For this the better we can do is to offer the user with a way to
> manually specify thoses dependencies for each distribution he wants
> to support.
>
>> About Eric's suggestion with "Generator"  specific dependencies, this
>> is not necessary for our application at the moment. What we want is
>> for a specific generator, to have "distribution" specific
>> dependencies.
>
> Yes I understood that but in the CPackConfig file you may setup distro
> specific deps from within generator specific case.
>
> save the attached CPackConfig.cmake file in your project directory
> then add
> set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.cmake)
> in your main CMakeLists.txt then
>
> rerun CMake
> run CPack and see what happen.
>
> I think that you'll see that it should suits your needs
> since you may already customize the dependencies
> in a distribution specific way for any CPack generator.
> May seems weird but it should work.
>
> This scheme supposes you are not "cross-packaging" like packaging
> a Fedora RPM on a debian host.
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>


More information about the CMake mailing list