# Adds Vulkan Memory Allocator using FetchContent.
#
# Uses:
# VKMEMALLOC_FETCH_CONTENT_VERSION (optional): Lets you select the Vulkan Memory Allocator version if you use fetch content.
#
# Defines:
# VKMEMALLOC_FOUND: true if the header was found successfully.
# VKMEMALLOC_HEADERS (only if VKMEMALLOC_FOUND is true): the directory containing the 'vk_mem_alloc.h' file.

if(NOT VKMEMALLOC_FETCH_CONTENT_VERSION)
	set(VKMEMALLOC_FETCH_CONTENT_VERSION v2.3.0)
endif()
include(FetchContent)
FetchContent_Declare(
		VKMEMALLOC
		GIT_REPOSITORY	https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
		GIT_TAG			${VKMEMALLOC_FETCH_CONTENT_VERSION}
)
if(NOT vkmemalloc_POPULATED)
	FetchContent_Populate(VKMEMALLOC)
endif()
set(VKMEMALLOC_INCLUDE_DIR "${vkmemalloc_SOURCE_DIR}/src")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VkMemAlloc DEFAULT_MSG VKMEMALLOC_INCLUDE_DIR)
if(VkMemAlloc_FOUND)
	set(VKMEMALLOC_HEADERS ${VKMEMALLOC_INCLUDE_DIR})
endif()