aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJuan Ramos <[email protected]>2022-11-07 12:42:34 -0700
committerJuan Ramos <[email protected]>2022-11-08 10:22:11 -0700
commite55c3116c119b594851e8a5289319a6305544a92 (patch)
treedc867a8cf7e4ddc6042b8f6040b13d1e633f2667
parent9cc8473bb9e7b35df4f44585c073ebaa08e86dfb (diff)
downloadVulkan-Headers-e55c3116c119b594851e8a5289319a6305544a92.tar.gz
Vulkan-Headers-e55c3116c119b594851e8a5289319a6305544a92.zip
cmake: Add VULKAN_HEADERS_INSTALL option
This allows projects which consume this repo with add_subdirectory to turn on/off the install logic, which can be undesirable.
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09b047c..7819608 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,4 +28,11 @@ add_library(Vulkan-Registry INTERFACE)
target_include_directories(Vulkan-Registry INTERFACE $<BUILD_INTERFACE:"${CMAKE_CURRENT_SOURCE_DIR}/registry">)
add_library(Vulkan::Registry ALIAS Vulkan-Registry)
-include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
+# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
+string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
+
+option(VULKAN_HEADERS_INSTALL "Install Vulkan Headers" ${PROJECT_IS_TOP_LEVEL})
+
+if (VULKAN_HEADERS_INSTALL)
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
+endif()