[CMake] CPack: Different installation prefixes per CPACK_GENERATOR

Eric Noulard eric.noulard at gmail.com
Fri Jun 19 16:38:39 EDT 2015


2015-06-19 21:13 GMT+02:00 Rainer Poisel <rainer.poisel at gmail.com>:

> Dear list,
>
> how can I specify different installation prefixes for the different
> CPACK_GENERATORs?
>
> For example:
>
>   * the DEB package should be installed to `/opt/project`
>   * the TGZ archive should consist only of the `project` directory
>
> From the documentation I understood that I would have to use the
> CPACK_PROJECT_CONFIG_FILE variable. Using that, it should be possible
> to achieve the desired goal. However, it did not work for me.
>
> This is my CPack configuration:
>
> 8<============================
> set(CPACK_GENERATOR "DEB;TGZ")
> set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/package.linux.txt)
> 8<============================
>

Did you set those before include(CPack) ?

>
> And this is my ${CMAKE_SOURCE_DIR}/cmake/package.linux.txt file:
>
> 8<============================
> IF (CPACK_GENERATOR MATCHES "DEB")
>     set(CPACK_NATIVE_INSTALL_DIRECTORY "/opt")
>     set(CMAKE_INSTALL_PREFIX "/opt")
>     set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")
>     set(CPACK_INSTALL_DIRECTORY "/opt")
> ELSEIF(CPACK_GENERATOR MATCHES "TGZ")
>     set(CPACK_NATIVE_INSTALL_DIRECTORY "")
>     set(CMAKE_INSTALL_PREFIX "")
>     set(CPACK_PACKAGING_INSTALL_PREFIX "")
>     set(CPACK_INSTALL_DIRECTORY "")
> ENDIF()
> 8<============================
>
> I ensured that all files get parsed using MESSAGE() directives, but
> the prefix of my packages is always /usr/local.
>

Looks good Strange enough...
 Would you be able to give us a standalone strip down example project of
this
and may be tell us which version of CPack/CMake you are using on which
platform.


What happen if you do something like;

cpack -G DEB -D CPACK_PACKAGING_INSTALL_PREFIX=/tmp

?

>
> Thanks for giving me a few hints,
>   Rainer
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150619/fb4a641f/attachment.html>


More information about the CMake mailing list