[CMake] Debian source package build/install

Andreas Pakulat apaku at gmx.de
Thu Jan 19 12:45:25 EST 2012


On 19.01.12 19:39:09, Anders Wallin wrote:
> Hi all,
> 
> For uploading to launchpad/PPA, I'm making a source-package with a
> cmake-script I found by googling:
> https://github.com/aewallin/opencamlib/blob/master/src/DebSourcePPA.cmake
> (please do let me know if there is a better way to build a debian
> source package with cmake!)
> 
> It seems to work, and the build completes, but the install fails:
> https://launchpadlibrarian.net/90444102/buildlog_ubuntu-oneiric-i386.opencamlib_11.10.13-ubuntu1~oneiric1_FAILEDTOBUILD.txt.gz
> (the error is at the very end of this file)
> 
> This error is reproducible on my local machine with pbuilder. The
> debian rules call cmake_install.cmake like this:
> cmake -DCOMPONENT=Unspecified -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr
> -P cmake_install.cmake
> 
> and line 44 of cmake_install.cmake that gives an error is
> FILE(INSTALL DESTINATION "/usr/lib/python2.7/dist-packages" TYPE
> MODULE FILES "/tmp/buildd/opencamlib-11.10.13/build_dir/ocl.so")
> the whole cmake_install.cmake file is here
> http://pastebin.com/NS6wmHxa   I don't see how it uses
> CMAKE_INSTALL_PREFIX at all?

Of course not, because you're giving CMake an absolute path, thats your
error.

> cmake_install.cmake is produced from my CMakeLists.txt like this:
> execute_process(
>     COMMAND python -c "from distutils.sysconfig import get_python_lib;
> print get_python_lib()"
>     OUTPUT_VARIABLE Python_site_packages
>     OUTPUT_STRIP_TRAILING_WHITESPACE # on Ubuntu 11.10 this outputs:
> /usr/lib/python2.7/dist-packages
> )
>     install(
>         TARGETS ocl
>         LIBRARY DESTINATION ${Python_site_packages}
>     )

See the manual for install, the problem is that you're setting an
absolute path here, this path will be used by CMake then for
installation. What you probably really want is a path relative to
whatever the 'prefix' was when python was installed (in this case /usr,
but maybe there's a way to query python for that, dunno). If you then
use a relative path here, it'll respect CMAKE_INSTALL_PREFIX (and
DESTDIR during the make-call).

Andreas



More information about the CMake mailing list