Juan Ramos 482af6d865 cmake: Remove VULKAN_HEADERS_INSTALL
VULKAN_HEADERS_INSTALL was added since it was believed there was
a valid use case for it.

After looking into the use case that provoked this change there is
no reason to keep VULKAN_HEADERS_INSTALL as an option.

Here is the use case we do NOT want to support:
https://github.com/KhronosGroup/Vulkan-Headers/pull/416#issuecomment-1622318949

Fundamentally this problem is caused add_subdirectory/find_package
not being able to work together flawlessly.

Which isn't the responsibility of Vulkan-Headers to fix.

It's the responsibility of projects that consume Vulkan-Headers
to account for either method.

As described by the CMake maintainers:
https://discourse.cmake.org/t/idiomatic-way-to-handle-packages-and-add-subdirectory/8400
2023-07-05 15:22:17 -06:00

24 lines
643 B
CMake

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()
# 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)
target_link_libraries(foobar PRIVATE Vulkan::Headers)
target_sources(foobar PRIVATE
../vk_icd.c
../vk_layer.c
)