I have a generic Component template that shall install different projects in the following manner:
/path/to/Components/<COMPONENT_NAME>/<COMPONENT_VERSION>/CONTENTS
My install rule in CMakeLists.txt looks like that:
install(TARGETS ${TARGET_NAME} DESTINATION lib PERMISSIONS ${FILE_PERMISSIONS})
install(FILES include/${TARGET_NAME}.h DESTINATION include PERMISSIONS ${FILE_PERMISSIONS}
By setting PERMISSIONS only, directories that are created by the install rule will have the umask of the system. Using the directory option of install is no fit for my usecase, as i only intend to install single/specific files (expecially in the include directory). I found a very great description/bugreport of the behavior. https://gitlab.kitware.com/cmake/cmake/-/issues/9620
With that new information i managed to set the CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS which resolves that issue in parts, but not fully. The thing is the installed directories shall have read and execute acces and no write access for user, group or others.
By setting :
set (CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
I'm not allowed anymore to create the subfolders/files inside the directory tree.
So the question is: Is there an option in cmake that installs the component (in userspace without root/admin privileges) and leaves the whole directory structure (of the newly created dirs) as OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE only? Basically it shall set write access on the directories while installing and end with setting the directories to the specified access flags.