diff --git a/CMakeLists.txt b/CMakeLists.txt index af1afe6..068eb46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,12 @@ if (VULKAN_HEADERS_ENABLE_INSTALL) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION "${CMAKE_INSTALL_DATADIR}/vulkan" USE_SOURCE_PERMISSIONS) set_target_properties(Vulkan-Headers PROPERTIES EXPORT_NAME "Headers") - install(TARGETS Vulkan-Headers EXPORT VulkanHeadersConfig INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + if (VULKAN_HEADERS_ENABLE_MODULE) + set_target_properties(Vulkan-HppModule PROPERTIES EXPORT_NAME "HppModule") + install(TARGETS Vulkan-Headers Vulkan-HppModule EXPORT VulkanHeadersConfig INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + else() + install(TARGETS Vulkan-Headers EXPORT VulkanHeadersConfig INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + endif() install(EXPORT VulkanHeadersConfig NAMESPACE "Vulkan::" DESTINATION "share/cmake/VulkanHeaders") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d21c835..04a7ff3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,7 +26,7 @@ add_test(NAME integration.find_package --build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration ${CMAKE_CURRENT_BINARY_DIR}/find_package --build-generator ${CMAKE_GENERATOR} - --build-options -DFIND_PACKAGE_TESTING=ON -DCMAKE_PREFIX_PATH=${test_install_dir} + --build-options -DFIND_PACKAGE_TESTING=ON -DCMAKE_PREFIX_PATH=${test_install_dir} -DVULKAN_HEADERS_ENABLE_MODULE=${VULKAN_HEADERS_ENABLE_MODULE} ) # Installing comes before testing diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index d120531..ea66a8d 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -27,9 +27,7 @@ if (FIND_PACKAGE_TESTING) message(FATAL_ERROR "VulkanHeaders_VERSION not defined!") endif() message(STATUS "VulkanHeaders_VERSION = ${VulkanHeaders_VERSION}") -endif() - -if (NOT FIND_PACKAGE_TESTING) +else() # 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!")