EventBus/lib/cmake/InstallHelp.cmake
Dawid Drozd d0d236dab0 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)
2019-12-29 13:13:34 +01:00

20 lines
569 B
CMake

#
# Installs files with preserving paths.
#
# Example usage:
# install_public_headers_with_directory(MyHeadersList "src/")
#
macro(install_public_headers_with_directory HEADER_LIST IGNORE_PREFIX)
foreach(HEADER ${${HEADER_LIST}})
get_filename_component(DIR ${HEADER} DIRECTORY)
string(REPLACE ${IGNORE_PREFIX} "" DIR ${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)
endmacro(install_public_headers_with_directory)