cmake: Don't REQUIRE find_package(VulkanHeaders)
authorJuan Ramos <juan@lunarg.com>
Thu, 5 Oct 2023 17:50:15 +0000 (11:50 -0600)
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>
Thu, 5 Oct 2023 18:45:06 +0000 (12:45 -0600)
Allows use of add_subdirectory with the loader

This is the same approach used by the validation layers.

CMakeLists.txt
scripts/CMakeLists.txt

index 5b7a430357b26ba9631f7e2d25a0cc27d55f78b5..d4f0a467f9796a6cd9416d8c1d4bd964b8553a30 100644 (file)
@@ -45,9 +45,7 @@ if(BUILD_STATIC_LOADER)
         "or tested as part of the loader. Use it at your own risk.")
 endif()
 
-if (NOT TARGET Vulkan::Headers)
-    find_package(VulkanHeaders REQUIRED CONFIG QUIET)
-endif()
+find_package(VulkanHeaders CONFIG QUIET)
 
 include(GNUInstallDirs)
 
index bf4d7c41976e44aedb4ad9c2edf3b4af1fc56ed7..4fce83e1b4ef2940901d48df2d7b1f5770e097dc 100644 (file)
@@ -103,6 +103,7 @@ if (UPDATE_DEPS)
 endif()
 if (VULKAN_HEADERS_INSTALL_DIR)
     list(APPEND CMAKE_PREFIX_PATH ${VULKAN_HEADERS_INSTALL_DIR})
+    set(CMAKE_REQUIRE_FIND_PACKAGE_VulkanHeaders TRUE PARENT_SCOPE)
 endif()
 
 if (CMAKE_CROSSCOMPILING)