[CMake] Recommended style for multiple CPack generator folder structures

clinton at elemtech.com clinton at elemtech.com
Tue May 24 15:03:48 EDT 2016


I prefer one for both installing and creating packages.


install(TARGETS bar
   COMPONENT bar
   DESTINATION "./" # This must be "./" not "/" as it has to be a relative path
)

Then set CMAKE_PREFIX_PATH=/Applications/Foo when you do an install.
CMAKE_PREFIX_PATH will be pre-pended to relative paths given in install() commands.

Clint

----- On May 24, 2016, at 5:40 AM, Harry Mallon Harry at codexdigital.com wrote:

> In answer to my own question. One way to do it which seems quite neat is as
> follows. Using multiple installs:
> 
> install(TARGETS bar
>    COMPONENT bar
>    DESTINATION "Applications/Foo"
> )
> 
> install(TARGETS bar
>    COMPONENT bar-standalone
>    DESTINATION "./" # This must be "./" not "/" as it has to be a relative path
> )
> 
> This in your CPACK_PROJECT_CONFIG_FILE:
> 
> if (CPACK_GENERATOR STREQUAL DragNDrop)
>    set(CPACK_COMPONENTS_ALL bar-standalone)
> endif()
> 
> Harry
> 
> Harry Mallon
> CODEX | Software Engineer
> 60 Poland Street | London | England | W1F 7NT
> E harry at codexdigital.com | T +44 203 7000 989
> --
> 
> 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


More information about the CMake mailing list