VulkanMemoryAllocator-Hpp
VulkanMemoryAllocator-Hpp copied to clipboard
Problems including VMA CMake project
Two issues I came across:
- VMA-Hpp links the VMA library as
VulkanMemoryAllocator::VulkanMemoryAllocator, even though VMA's CMakeLists.txt does not alias the namespace anywhere. I don't know if it's an issue with my installation, but I can't see anything suggesting that might work. - Current CMakeLists.txt doesn't allow VMA-Hpp's users to supply their own VMA Cmake project. I suggest a solution in the code block below:
if(TARGET VulkanMemoryAllocator)
add_library(VulkanMemoryAllocator::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VulkanMemoryAllocator/CMakeLists.txt)
add_subdirectory(VulkanMemoryAllocator)
else()
find_package(VulkanMemoryAllocator REQUIRED)
endif()
Obviously the VulkanMemoryAllocator::VulkanMemoryAllocator situation should be resolved first. Maybe that's how it shows up if find_package does its thing? I don't know since VMA is not installed as a package on my system. If that's the case, then the alias should also be added after the add_subdirectory statement.
Hi! Would you mind opening a PR for this?