[CMake] Getting empty package with CPack

Tim Gallagher tim.gallagher at gatech.edu
Wed Mar 11 18:54:18 EDT 2015


Nils,

Thanks! That definitely got my files into the package, I would have never figured that one out!

I have another, related question though. Maybe what I'm doing cannot be done, but I would like to have a different file layout when building a package than when using make install. I thought if I did:

set(CPACK_INSTALL_CMAKE_PROJECTS "${PROJECT_BINARY_DIR};LESLIE;ALL;/bin")

then all of my targets would go in <package name>/bin even though when I run `make install` all of my targets just go to $CMAKE_INSTALL_PREFIX. The way users who only have access to our binaries would use our code is very different from the way people who have access to our source tree would use the code and I need to figure out a way to package it that way.

Is it at all possible to have an install tree be unique when using CPack vs using the installation in CMake? Is that something that if I want to do, I'd have to use CPack outside of our CMake system? 

Thanks,

Tim

----- Original Message -----
From: "Nils Gladitz" <nilsgladitz at gmail.com>
To: "tim gallagher" <tim.gallagher at gatech.edu>, cmake at cmake.org
Sent: Wednesday, March 11, 2015 6:32:24 PM
Subject: Re: [CMake] Getting empty package with CPack

On 11.03.2015 21:17, Tim Gallagher wrote:
> Hi all,
>
> I'm trying to play with CPack to build an installer for our code and I'm pretty confused. I am using the self-extracting TGZ generator on CMake 2.8.8. My CMakeLists.txt is really long, but I included what I think are the important parts under my signature.
>
> I configure the build and the package target shows up which is great. I can see in the CPackConfig.cmake file that my variables are set the same as they were in my CMakeLists.txt. When I run 'make package', it generates my .sh file. But then when I run the extractor, it just creates an empty folder. I would have expected it to create `<package name>/bin/leslie.x`, `<package name>/bin/run_leslie.py` and `<package name>/bin/run_leslie.sh`.
>
> I also tried it with the CPACK_INSTALL_CMAKE_PROJECTS set to "${PROJECT_BINARY_DIR};LESLIE;leslie;/bin" but to no avail.
>
> Does anybody have any suggestions on why my files aren't getting packaged? I know the CMakeLists.txt prior to the CPack commands work, but this is my first go at using CPack.

Try with relative install destinations e.g. "DESTINATION ." instead of 
"DESTINATION ${CMAKE_INSTALL_PREFIX}".
Relative paths are already relative to CMAKE_INSTALL_PREFIX by default 
where appropriate and many CPack generators can not handle absolute paths.

Nils


More information about the CMake mailing list