diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FileInstall.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cmake/modules/FileInstall.cmake b/cmake/modules/FileInstall.cmake new file mode 100644 index 0000000000..3358aa2a80 --- /dev/null +++ b/cmake/modules/FileInstall.cmake @@ -0,0 +1,33 @@ +# FileInstall - Install files and directories separately from the +# "install" command. +# +# Usage: +# cmake -P /path/to/FileInstall.cmake [source ...] [destination] + +# Params are +# cmake -P /path/to/hhc.cmake "/path/to/hhc.exe" project.hhp +math(EXPR _dest_idx "${CMAKE_ARGC} - 1") +set(_destination ${CMAKE_ARGV${_dest_idx}}) +set(_sources) + +math(EXPR _last_src "${CMAKE_ARGC} - 2") +foreach(_src_idx RANGE 3 ${_last_src}) + set(_sources ${_sources} ${CMAKE_ARGV${_src_idx}}) +endforeach(_src_idx) + +if (_sources AND _destination) + message (STATUS "Installing ${_sources} to ${_destination}") + file (INSTALL ${_sources} + DESTINATION ${_destination} + FILE_PERMISSIONS + OWNER_WRITE OWNER_READ + GROUP_READ + WORLD_READ + DIRECTORY_PERMISSIONS + OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ + WORLD_EXECUTE WORLD_READ + ) +else() + message (FATAL_ERROR "Missing arguments. Sources: ${_sources}. Destination: ${_destination}.") +endif() |