diff options
author | Juan Ramos <[email protected]> | 2023-06-29 11:10:07 -0600 |
---|---|---|
committer | Juan Ramos <[email protected]> | 2023-06-30 09:56:11 -0600 |
commit | ad5f8ee9750e99c5397d44c075ae5d8a38271de4 (patch) | |
tree | c2d7f5f74dc61235d3546bc23c5224b1393296f1 /tests | |
parent | 60b89abf43a687e454f7ff6f6bfe642118e358e8 (diff) | |
download | Vulkan-Headers-ad5f8ee9750e99c5397d44c075ae5d8a38271de4.tar.gz Vulkan-Headers-ad5f8ee9750e99c5397d44c075ae5d8a38271de4.zip |
cmake: Add VULKAN_HEADERS_INSTALL option
Allows add_subdirectory users to install vulkan-headers
Diffstat (limited to 'tests')
-rw-r--r-- | tests/add_subdirectory/CMakeLists.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/add_subdirectory/CMakeLists.txt b/tests/add_subdirectory/CMakeLists.txt new file mode 100644 index 0000000..74f2066 --- /dev/null +++ b/tests/add_subdirectory/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.14.2) + +project(TEST_VULKAN_HEADERS_ADD_SUBDIRECTORY_SUPPORT LANGUAGES C) + +add_subdirectory(../../ ${CMAKE_CURRENT_BINARY_DIR}/headers) + +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!") +endif() + +add_library(foobar STATIC) + +target_link_libraries(foobar PRIVATE Vulkan::Headers) + +target_sources(foobar PRIVATE + ../vk_icd.c + ../vk_layer.c +) |