[CMake] CPack and executable permissions on linux

Kristian kristianonline28 at gmail.com
Wed Jun 8 11:58:10 EDT 2016


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160608/367ca6c8/attachment-0001.html>


More information about the CMake mailing list