aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Kessenich <johnkslang@users.noreply.github.com>2018-07-02 15:15:41 -0600
committerGitHub <noreply@github.com>2018-07-02 15:15:41 -0600
commit02efabdc2e275b2306ac47ed01b1f178e2854350 (patch)
tree0fec7ea4fac079a67e53fd2e7c1fce76e86a3ea3
parent8ffa90c384472c41f405a86f1ec3564d71c3e8a1 (diff)
parent7de7b23f6e6b9da1b85a94dc781800ba4462bf27 (diff)
downloadSPIRV-Headers-02efabdc2e275b2306ac47ed01b1f178e2854350.tar.gz
Merge pull request #49 from jdknight/cmake-install-cleanup
cmake: support default install target
-rw-r--r--CMakeLists.txt17
-rw-r--r--README.md5
2 files changed, 14 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5bff17..2488baf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@
# The SPIR-V headers from the SPIR-V Registry
# https://www.khronos.org/registry/spir-v/
#
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.11)
project(SPIRV-Headers)
# There are two ways to use this project.
@@ -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
+ $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/include/spirv)
add_subdirectory(example)
diff --git a/README.md b/README.md
index 4c3d5d4..846b20d 100644
--- a/README.md
+++ b/README.md
@@ -35,10 +35,7 @@ Pull requests can be made to
mkdir build
cd build
cmake ..
-# Linux
-cmake --build . --target install-headers
-# Windows
-cmake --build . --config Debug --target install-headers
+cmake --build . --target install
```
Then, for example, you will have `/usr/local/include/spirv/unified1/spirv.h`