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<============================

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.

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

Reply via email to