From 5407d73452d368f03ebd51597d623a616c66ee64 Mon Sep 17 00:00:00 2001 From: Jan Kuhlmann <33833587+M2-TE@users.noreply.github.com> Date: Thu, 3 Apr 2025 13:16:43 +0200 Subject: [PATCH] installing module and exporting via CXX_MODULES_DIRECTORY --- CMakeLists.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e11053d..5ac0ab7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,14 +115,26 @@ 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") - list(APPEND INSTALL_TARGETS Vulkan-Headers) if (VULKAN_HEADERS_ENABLE_MODULE) + # install Vulkan-Hpp module alongside headers set_target_properties(Vulkan-HppModule PROPERTIES EXPORT_NAME "HppModule") - list(APPEND INSTALL_TARGETS Vulkan-HppModule) + install(TARGETS Vulkan-Headers Vulkan-HppModule + EXPORT VulkanHeadersConfig + FILE_SET module DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(EXPORT VulkanHeadersConfig + NAMESPACE "Vulkan::" + DESTINATION "share/cmake/VulkanHeaders" + CXX_MODULES_DIRECTORY .) + else() + # only install vulkan headers + install(TARGETS Vulkan-Headers + EXPORT VulkanHeadersConfig + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(EXPORT VulkanHeadersConfig + NAMESPACE "Vulkan::" + DESTINATION "share/cmake/VulkanHeaders") endif() - install(TARGETS ${INSTALL_TARGETS} EXPORT VulkanHeadersConfig INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - - install(EXPORT VulkanHeadersConfig NAMESPACE "Vulkan::" DESTINATION "share/cmake/VulkanHeaders") set(version_config "${CMAKE_CURRENT_BINARY_DIR}/generated/VulkanHeadersConfigVersion.cmake") write_basic_package_version_file("${version_config}" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)