# Setting default install permissions globally

**URL:** https://discourse.cmake.org/t/setting-default-install-permissions-globally/1598
**Category:** Development
**Created:** [July 21, 2020, 9:28am UTC](https://discourse.cmake.org/t/setting-default-install-permissions-globally/1598 "2020-07-21T09:28:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![globberwops](https://discourse.cmake.org/user_avatar/discourse.cmake.org/globberwops/32/754_2.png) [@globberwops](https://discourse.cmake.org/u/globberwops)
#### Post date: [July 21, 2020, 9:28am UTC](https://discourse.cmake.org/t/setting-default-install-permissions-globally/1598/1 "2020-07-21T09:28:21Z")

</div>

I would like to be able to set global default install permissions, so I don’t have to either rewrite each and every `install(...)` command, or override it with a custom `install(...)` command in my project.

There already is the `CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` variable for implicitly created dirs during installation.

The following additional variables could be added for all the different install command signatures:

- `CMAKE_INSTALL_DEFAULT_TARGET_ARCHIVE_PERMISSIONS` for `install(TARGETS ...)`
- `CMAKE_INSTALL_DEFAULT_TARGET_LIBRARY_PERMISSIONS` for `install(TARGETS ...)`
- `CMAKE_INSTALL_DEFAULT_TARGET_RUNTIME_PERMISSIONS` for `install(TARGETS ...)`
- …

In my project I could then just e.g. `list(APPEND CMAKE_INSTALL_DEFAULT_TARGET_ARCHIVE_PERMISSIONS GROUP_WRITE)`

I could also set the global install permissions in an initial cache file.

Another benefit would be the ability to change the install permissions of upstream projects on configuration.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [July 21, 2020, 10:46am UTC](https://discourse.cmake.org/t/setting-default-install-permissions-globally/1598/2 "2020-07-21T10:46:39Z")

</div>

Having variables to tell `install()` about default `PERMISSIONS` arguments sounds reasonable to me.

`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` is slightly distinct from that idea because it applies to cases where directories are implicitly created as part of preparing the `DESTINATION` for files in `install()` calls that only define permissions for the files themselves. The variables proposed here will modify the default permissions that `install()` otherwise defines already.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 11, 2020, 5:27pm UTC](https://discourse.cmake.org/t/setting-default-install-permissions-globally/1598/3 "2020-11-11T17:27:14Z")

</div>

It seems this never got turned into an issue. As a precedent, we do have [https://gitlab.kitware.com/cmake/cmake/-/issues/20700](https://gitlab.kitware.com/cmake/cmake/-/issues/20700) for default directory permissions.

Edit: And filed: [https://gitlab.kitware.com/cmake/cmake/-/issues/21424](https://gitlab.kitware.com/cmake/cmake/-/issues/21424)
