summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Knight <james.d.knight@live.com>2017-09-27 23:05:35 -0400
committerJames Knight <james.d.knight@live.com>2017-09-27 23:05:35 -0400
commit4ca4743e9dfcd5bb58fb6384051eb32ade49fbf0 (patch)
treeca01d3103e09e97d06921074370b134b8a705d5f
parentb8d95fb37e1b1d4fd61af907be057ad469d262e5 (diff)
downloadSPIRV-Headers-4ca4743e9dfcd5bb58fb6384051eb32ade49fbf0.tar.gz
SPIRV-Headers-4ca4743e9dfcd5bb58fb6384051eb32ade49fbf0.tar.bz2
SPIRV-Headers-4ca4743e9dfcd5bb58fb6384051eb32ade49fbf0.zip
cmake: support default install target
Allow the common install target to support the installation of header files (rather then having a custom target). Developers should be able to invoke the install target as follows: cmake --build . --target install This commit leaves the original custom target to install headers for interim support. Signed-off-by: James Knight <james.d.knight@live.com>
-rw-r--r--CMakeLists.txt15
1 files changed, 12 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be7d88a..b4ad4c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,10 +42,19 @@ project(SPIRV-Headers)
# directory. To install the headers:
# 1. mkdir build ; cd build
# 2. cmake ..
-# 3. cmake --build . install-headers
+# 3. cmake --build . --target install
-file(GLOB_RECURSE FILES include/spirv/*)
+file(GLOB_RECURSE HEADER_FILES
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ include/spirv/*)
+foreach(HEADER_FILE ${HEADER_FILES})
+ get_filename_component(HEADER_INSTALL_DIR ${HEADER_FILE} PATH)
+ install(FILES ${HEADER_FILE} DESTINATION ${HEADER_INSTALL_DIR})
+endforeach()
+
+# legacy
add_custom_target(install-headers
- COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv ${CMAKE_INSTALL_PREFIX}/include/spirv)
+ COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv
+ ${CMAKE_INSTALL_PREFIX}/include/spirv)
add_subdirectory(example)