if(wgpu-native_FOUND)
	set(wgpu-native_FIND_QUIETLY TRUE)
endif()

# Don't search for include files - these are bundled with psemek-wgpu lib
find_library(wgpu-native_LIBRARY NAMES libwgpu_native.a wgpu_native.dll wgpu_native PATHS "${WGPU_NATIVE_ROOT}" "${WGPU_NATIVE_ROOT}/lib")
find_file(wgpu-native_VERSION_FILE wgpu-native-git-tag PATHS "${WGPU_NATIVE_ROOT}/wgpu-native-meta")

if(EXISTS "${wgpu-native_VERSION_FILE}")
	file(READ "${wgpu-native_VERSION_FILE}" wgpu-native_VERSION_NOT_STRIPPED)
	string(STRIP "${wgpu-native_VERSION_NOT_STRIPPED}" wgpu-native_VERSION_STRIPPED)
	string(SUBSTRING "${wgpu-native_VERSION_STRIPPED}" 1 -1 wgpu-native_VERSION)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(wgpu-native
	REQUIRED_VARS wgpu-native_LIBRARY wgpu-native_VERSION_FILE
	VERSION_VAR wgpu-native_VERSION
)

if(wgpu-native_FOUND AND NOT TARGET wgpu-native)
	set(wgpu-native_LIBRARIES ${wgpu-native_LIBRARY})
	add_library(wgpu-native STATIC IMPORTED)
	set_target_properties(wgpu-native PROPERTIES
		IMPORTED_LOCATION "${wgpu-native_LIBRARIES}"
	)
endif()

mark_as_advanced(wgpu-native_LIBRARY wgpu-native_VERSION_FILE)
