0

Given a CMakeLists.txt like:

PROJECT(asdf NONE)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

INSTALL(FILES CMakeLists.txt DESTINATION share/doc/asdf/whatever)

SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_CONTACT "asdf@example.com")
INCLUDE(CPack)

The package generated by make package has following contents:

$ dpkg-deb --contents asdf-0.1.1-Linux.deb 
drwx------ root/root         0 2017-12-20 10:50 ./usr/
drwx------ root/root         0 2017-12-20 10:50 ./usr/share/
drwx------ root/root         0 2017-12-20 10:50 ./usr/share/doc/
drwx------ root/root         0 2017-12-20 10:50 ./usr/share/doc/asdf/
drwx------ root/root         0 2017-12-20 10:50 ./usr/share/doc/asdf/whatever/
-rw-r--r-- root/root       235 2017-12-20 10:50 ./usr/share/doc/asdf/whatever/CMakeLists.txt

with the parent directories having only permission bits for the owner. How do I correct these so that the world could read the files I install, e.g. for these to be something like drwxr-xr-x instead?

jotik
  • 17,044
  • 13
  • 58
  • 123

1 Answers1

1

In a discussion with CMake developer Nils Gladitz we were able to track this issue down the umask of the environment affecting this. If the umask in the environment is set to 0022 instead of 0077, then make package generates the package with different permissions:

$ dpkg-deb --contents asdf-0.1.1-Linux.deb 
drwxr-xr-x root/root         0 2017-12-20 11:17 ./usr/
drwxr-xr-x root/root         0 2017-12-20 11:17 ./usr/share/
drwxr-xr-x root/root         0 2017-12-20 11:17 ./usr/share/doc/
drwxr-xr-x root/root         0 2017-12-20 11:17 ./usr/share/doc/asdf/
drwxr-xr-x root/root         0 2017-12-20 11:17 ./usr/share/doc/asdf/whatever/
-rw-r--r-- root/root       235 2017-12-20 10:50 ./usr/share/doc/asdf/whatever/CMakeLists.txt

Nils noted that this is apparently an old unfixed issue[1][2].

Thank you, Nils! =)

jotik
  • 17,044
  • 13
  • 58
  • 123