diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2021-11-10 14:55:42 (GMT) |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2021-11-10 15:11:46 (GMT) |
commit | db8bd5965fcce423748b1dc3120505c6c30df00b (patch) | |
tree | 52ea567467924594e35acbb7523885a967edeaef /Modules | |
parent | 19b51730b7bd9b1325f4f124dcda90effaf4a221 (diff) | |
download | CMake-db8bd5965fcce423748b1dc3120505c6c30df00b.zip CMake-db8bd5965fcce423748b1dc3120505c6c30df00b.tar.gz CMake-db8bd5965fcce423748b1dc3120505c6c30df00b.tar.bz2 |
FindVulkan: Fix finding versions < 1.2.175
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindVulkan.cmake | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 078e367..527ca8b 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -143,10 +143,15 @@ if(Vulkan_INCLUDE_DIR) if(EXISTS ${VULKAN_CORE_H}) file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION ") string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion "${VulkanHeaderVersionLine}") - file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION_COMPLETE ") - # "#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION)" - string(REGEX REPLACE ".*\\([0_9]+[, ]+([0-9]+)[, ]+([0-9]+)[, ].*\\)" - "\\1.\\2.${VulkanHeaderVersion}" Vulkan_VERSION "${VulkanHeaderVersionLine}") + file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ") + string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}") + list(LENGTH VulkanHeaderVersion2 _len) + # versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2' + if(_len EQUAL 3) + list(REMOVE_AT VulkanHeaderVersion2 0) + endif() + list(APPEND VulkanHeaderVersion2 ${VulkanHeaderVersion}) + list(JOIN VulkanHeaderVersion2 "." Vulkan_VERSION) endif() endif() |