Create Vulkan::Headers if CMake version is too low.

This commit is contained in:
Charles Giessen 2023-12-14 11:20:51 -07:00 committed by Charles Giessen
parent c16df41166
commit ae05c97bdb

View File

@ -35,7 +35,16 @@ elseif(NOT TARGET Vulkan::Headers)
if (NOT VulkanHeaders_FOUND)
# Try looking using the CMake built in Vulkan support
find_package(Vulkan QUIET)
if(NOT Vulkan_FOUND)
if(Vulkan_FOUND)
# Older CMake versions don't contain Vulkan::Headers - create it in that case
if (NOT TARGET Vulkan::Headers)
add_library(Vulkan-Headers INTERFACE)
add_library(Vulkan::Headers ALIAS Vulkan-Headers)
target_include_directories(Vulkan-Headers INTERFACE $<BUILD_INTERFACE:${Vulkan_INCLUDE_DIRS}>)
set(VK_BOOTSTRAP_INSTALL OFF)
endif()
else()
# Lastly just grab Vulkan-Headers directly using FetchContent
include(FetchContent)
FetchContent_Declare(