myx/MyxCMake/lib/macro/InstallRelative.cmake

20 lines
695 B
CMake
Raw Normal View History

2022-10-02 13:23:05 +00:00
#[=======================================================================[.rst:
install_relative
----------------
#]=======================================================================]
macro(install_relative STRIP_DIRECTORY)
set(options)
set(oneValueArgs DESTINATION)
set(multiValueArgs FILES)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
foreach(FILE ${ARG_FILES})
get_filename_component(DIR ${FILE} DIRECTORY)
string(REPLACE ${STRIP_DIRECTORY} "" RELATIVE_DIR ${DIR})
INSTALL(FILES ${FILE} DESTINATION ${ARG_DESTINATION}/${RELATIVE_DIR} ${ARG_UNPARSED_ARGUMENTS})
endforeach()
2022-10-02 19:07:06 +00:00
endmacro(install_relative STRIP_DIRECTORY)