forked from Eyescale/CMake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallFiles.cmake
More file actions
27 lines (23 loc) · 801 Bytes
/
InstallFiles.cmake
File metadata and controls
27 lines (23 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) 2012 Stefan.Eilemann@epfl.ch
# Usage: install_files(<prefix> FILES <files> [COMPONENT <name>])
# Installs files while preserving their relative directory. Files
# with an absolute path are installed directly into prefix.
include(CMakeParseArguments)
function(INSTALL_FILES PREFIX)
set(ARG_NAMES COMPONENT)
set(ARGS_NAMES FILES)
cmake_parse_arguments(THIS "" "${ARG_NAMES}" "${ARGS_NAMES}" ${ARGN})
foreach(FILE ${THIS_FILES})
if(IS_ABSOLUTE ${FILE})
set(DIR)
else()
string(REGEX MATCH "(.*)[/\\]" DIR ${FILE})
endif()
if(THIS_COMPONENT)
install(FILES ${FILE} DESTINATION ${PREFIX}/${DIR}
COMPONENT ${THIS_COMPONENT})
else()
install(FILES ${FILE} DESTINATION ${PREFIX}/${DIR})
endif()
endforeach()
endfunction()