Secure installed files

We should be able to remove installed stuff but we want to forbid changes in installed files.
Thanks to that we do not modify files by mistake directly from e.g. Clion (when we go to
header/source)
This commit is contained in:
Dawid Drozd 2019-12-29 13:13:34 +01:00
parent 2bc2858a8a
commit d0d236dab0
2 changed files with 10 additions and 1 deletions

View File

@ -122,6 +122,8 @@ configure_package_config_file(
install( install(
FILES "${project_config}" "${version_config}" FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}" DESTINATION "${config_install_dir}"
# We don't want someone by accident modify his installed files
PERMISSIONS OWNER_EXECUTE OWNER_READ
) )
# Config # Config
@ -129,6 +131,8 @@ install(
install(EXPORT "${TARGETS_EXPORT_NAME}" install(EXPORT "${TARGETS_EXPORT_NAME}"
DESTINATION "${config_install_dir}" DESTINATION "${config_install_dir}"
NAMESPACE "${namespace}" NAMESPACE "${namespace}"
# We don't want someone by accident modify his installed files
PERMISSIONS OWNER_EXECUTE OWNER_READ
) )
# Export headers (Install public headers) # Export headers (Install public headers)

View File

@ -8,7 +8,12 @@ macro(install_public_headers_with_directory HEADER_LIST IGNORE_PREFIX)
foreach(HEADER ${${HEADER_LIST}}) foreach(HEADER ${${HEADER_LIST}})
get_filename_component(DIR ${HEADER} DIRECTORY) get_filename_component(DIR ${HEADER} DIRECTORY)
string(REPLACE ${IGNORE_PREFIX} "" DIR ${DIR}) string(REPLACE ${IGNORE_PREFIX} "" DIR ${DIR})
install(FILES ${HEADER} DESTINATION include/${DIR}) install(
FILES ${HEADER}
DESTINATION include/${DIR}
# We don't want someone by accident modify his installed files
PERMISSIONS OWNER_EXECUTE OWNER_READ
)
endforeach(HEADER) endforeach(HEADER)
endmacro(install_public_headers_with_directory) endmacro(install_public_headers_with_directory)