summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--tests/add_subdirectory/CMakeLists.txt9
2 files changed, 4 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d61e75f..28b8caf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,19 +57,14 @@ if (PROJECT_IS_TOP_LEVEL)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
-endif()
-option(VULKAN_HEADERS_INSTALL "Install Vulkan Headers" ${PROJECT_IS_TOP_LEVEL})
-if (VULKAN_HEADERS_INSTALL)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
- set(VLK_REGISTRY_DIR "${CMAKE_INSTALL_DATADIR}/vulkan")
-
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vk_video" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Preserve source permissions https://github.com/KhronosGroup/Vulkan-Headers/issues/336
- install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION ${VLK_REGISTRY_DIR} USE_SOURCE_PERMISSIONS)
+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION "${CMAKE_INSTALL_DATADIR}/vulkan" USE_SOURCE_PERMISSIONS)
set_target_properties(Vulkan-Headers PROPERTIES EXPORT_NAME "Headers")
diff --git a/tests/add_subdirectory/CMakeLists.txt b/tests/add_subdirectory/CMakeLists.txt
index 74f2066..cb8fdcc 100644
--- a/tests/add_subdirectory/CMakeLists.txt
+++ b/tests/add_subdirectory/CMakeLists.txt
@@ -8,12 +8,9 @@ if (NOT TARGET Vulkan::Headers)
message(FATAL_ERROR "Vulkan::Headers target not defined")
endif()
-# By default installation for a subproject should be disabled.
-# This makes it easier to consume for most projects.
-# Consuming the vulkan-headers via add_subdirectory and installing
-# them is the more niche use case.
-if (VULKAN_HEADERS_INSTALL)
- message(FATAL_ERROR "VULKAN_HEADERS_INSTALL should be OFF!")
+# Consuming vulkan-headers via add_subdirectory should NOT add installation code to the parent CMake project.
+if (DEFINED CMAKE_INSTALL_INCLUDEDIR)
+ message(FATAL_ERROR "CMAKE_INSTALL_INCLUDEDIR was defined!")
endif()
add_library(foobar STATIC)