[CMake] CPack install directory

David Cole david.cole at kitware.com
Fri Jan 11 06:18:15 EST 2008


This reply applies to CVS CMake only. This functionality is new and is *not*
in the CMake-2-4 branch.

In your main CMakeLists.txt file (or wherever you set all your other CPack
options) do something like this:
  CONFIGURE_FILE("${MyProject_SOURCE_DIR}/MyProjectCPackOptions.cmake.in"
    "${MyProject_BINARY_DIR}/MyProjectCPackOptions.cmake" @ONLY)
  SET(CPACK_PROJECT_CONFIG_FILE
"${MyProject_BINARY_DIR}/MyProjectCPackOptions.cmake")

And then in the file
"${MyProject_SOURCE_DIR}/MyProjectCPackOptions.cmake.in" do this:
  IF("${CPACK_GENERATOR}" STREQUAL "DEB")
    SET(CPACK_PACKAGING_INSTALL_PREFIX "/")
  ENDIF("${CPACK_GENERATOR}" STREQUAL "DEB")

The CPACK_PROJECT_CONFIG_FILE, if there is one, is read during package
generation by CPack. It is read once for each generator and CPACK_GENERATOR
will be set to the exact generator being used. The
CPACK_PACKAGING_INSTALL_PREFIX is used as the root of the install tree when
building the end user installer package.


Hope this helps, (sorry it took a while to reply)
David Cole


On 12/17/07, Raphael Cotty <raphael.cotty at googlemail.com> wrote:
>
> Hi,
> I am using CPack with DEB generator. My install dir is in
> /work/install/Project and I have a usr and a etc dir installed.
> But the debian package generated by CPack inserts a usr directory so I get
> my usr in usr/usr and my etc in /usr/etc.
> I don't manage to understand why and where is inserted this directory.
> Any idea how I could remove it?
>
> Thanks very much!
> Raph
>
> ps:
> I am using cmake and cpack version 2.5-20071214.
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080111/56438525/attachment.htm


More information about the CMake mailing list