cmake: Add VULKAN_HEADERS_INSTALL option

This allows projects which consume this repo with add_subdirectory
to turn on/off the install logic, which can be undesirable.
This commit is contained in:
Juan Ramos 2022-11-07 12:42:34 -07:00 committed by Juan Ramos
parent 9cc8473bb9
commit e55c3116c1

View file

@ -28,4 +28,11 @@ add_library(Vulkan-Registry INTERFACE)
target_include_directories(Vulkan-Registry INTERFACE $<BUILD_INTERFACE:"${CMAKE_CURRENT_SOURCE_DIR}/registry">)
add_library(Vulkan::Registry ALIAS Vulkan-Registry)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
option(VULKAN_HEADERS_INSTALL "Install Vulkan Headers" ${PROJECT_IS_TOP_LEVEL})
if (VULKAN_HEADERS_INSTALL)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)
endif()