[CMake] CPack and executable permissions on linux

Micha Hergarden micha.hergarden at gmail.com
Wed Jun 8 13:56:53 EDT 2016


On 08/06/16 17:58, Kristian wrote:
> Hey guys,
>
> I am creating a RPM package with CMake. Here is a small example of how
> it looks:
>
> ========
>
> cmake_minimum_required(VERSION 3.5)
>
> set(BOOST_LIB "${CMAKE_CURRENT_SOURCE_DIR}/boost")
>
> file(GLOB_RECURSE BOOST_LIBRARIES ${BOOST_LIB}/*)
>
> install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/usr/bin/executable
> DESTINATION bin)
> install(FILES ${BOOST_LIBRARIES} DESTINATION lib)
>
> set(CPACK_GENERATOR "RPM")
> set(CPACK_PACKAGE_VERSION 6.5)
> set(CPACK_PACKAGE_NAME "executable-proj")
> # set(CPACK_RPM_PACKAGE_NAME "executable-proj")
> set(CPACK_RPM_PACKAGE_SUMMARY "Simple executable project")
> set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64)
> set(CPACK_PACKAGE_VENDOR "Some Vendor Limited")
> set(CPACK_RPM_PACKAGE_MAINTAINER "Some Vendor Limited")
> set(CPACK_RPM_PACKAGE_AUTOREQ "NO")
> set(CPACK_PACKAGE_EXECUTABLES "executable")
>
> INCLUDE(CPack)
>
> ======
>
> Before running this cmake script, I am setting executable permissions
> on the build machine, where the package is created.
>
> Then, I create a docker image, where this RPM is downloaded and
> installed. But when I want to start the executable within a docker
> container, then I am getting the message "permission denied". 
> When I look at the permissions of my installed package, then I see, I
> only have read permissions.
>
> So the question is: What can I do for getting executable permissions
> for this executable? Is this a CMake/CPack problem?
>
>
Hi Kristian,

Did you take a look at the manual page for the install command: cmake
--help-command install? I think your issue may be resolved by using the
'install(TARGETS ...' instead of 'install(FILES ...)'.

Best regards,

Micha

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160608/af96d516/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160608/af96d516/attachment.sig>


More information about the CMake mailing list