unR
unR

Reputation: 1318

How can I package a symlink with cpack?

I've seen many linux applications packaged with their binaries in some path like /opt/mypkg/myexecutable and a symlink to it in /usr/bin. I've seen these symlinks in the packaged files.

I want to do the same while packaging my software with cpack, creating deb and rpm packages with CPackDEB and CPackRPM.

Or am I just missing a cpack directive that does the job correctly?

Upvotes: 5

Views: 3599

Answers (1)

David Marquant
David Marquant

Reputation: 2237

Have a look at the following example:

cmake_minimum_required(VERSION 3.0)
project(myls NONE)

execute_process(COMMAND ln -s /opt/myapp/superls myls)

install(FILES ${CMAKE_BINARY_DIR}/myls DESTINATION /usr/bin/myapp COMPONENT MyComponent)

SET(CPACK_PACKAGE_CONTACT dmarquant)
include(CPack)

You can simply create a symlink to a non existing location and as you have written install it with install(FILES ...).

Upvotes: 5

Related Questions