[CMake] Setting target destination and rpath per generator

Alexander Neundorf a.neundorf-work at gmx.net
Tue Feb 15 15:45:25 EST 2011


On Tuesday 15 February 2011, Daryl N wrote:
> Hi,
>
> I have a question on the use of CPack.  I have CMake setup to generate
> binaries and shared libraries.  Up until now I have only created a TGZ with
> rpath set to ".".  This has worked nicely, but now I would like to create a
> Debian package for proper installation.  I have added DEB to
> CPACK_GENERATOR and I've created my own cpack_config.cmake file.  My goal
> is:
>
> 1. Run cmake/make package once and create the tar.gz file with all exe/libs
> in the root folder of the tar.gz file with rpath set to ".".
> 2. Create new .deb package with exes in /usr/local/bin and libs in
> /usr/local/lib.  Alternatively, since files are private, all could be put
> in /usr/local/<some folder>.
>
> I've attempted this by creating my own cpack_config.cmake file to try to
> override some settings per generator.  Some observations:
>
> 1. I've been unable to set the install(<target> DESTINATION) path per
> generator in my cpack_config.cmake file.  Whatever the variable is set to
> when the install(...) is processed in the CMakeLists.txt file is what is
> used for all generators.  Just want to confirm changing this isn't an
> option per generator.
>
> The above has prevented me from having my install lines like:
>     install(<target> DESTINATION ${BIN_PATH})
>     install(<target> DESTINATION ${LIB_PATH})
> and then setting BIN_PATH to bin and LIB_PATH to lib for DEB, but setting
> them to "." for TGZ, since I can't change the variable in
> cpack_config.cmake.

Are you sure "." does what you want ? I can remember I tried it to, and didn't 
what I needed, but I can't remember the details.

Do you know about $ORIGIN for the RPATH ? This means the location of the 
containing ELF file.

Alex


More information about the CMake mailing list