if (NOT DEFINED VENDOR_DIR)
	if (DEFINED ENV{VENDOR_DIR})
		set(VENDOR_DIR $ENV{VENDOR_DIR})
		message(STATUS "VENDOR_DIR is set from environment: ${VENDOR_DIR}")
	endif()
endif()

macro(sources_url PKGNAME VENDOR_PATH FALLBACK_URL)
	if (DEFINED VENDOR_DIR)
		set(${PKGNAME}_PATH "${VENDOR_DIR}/${VENDOR_PATH}")
		if (EXISTS "${${PKGNAME}_PATH}")
			set(${PKGNAME}_URL "file://${${PKGNAME}_PATH}")
			message(STATUS "Found sources for ${PKGNAME} in VENDOR_DIR: ${${PKGNAME}_URL}")
		endif()
	endif()
	if (NOT DEFINED ${PKGNAME}_URL)
		set(${PKGNAME}_URL "${FALLBACK_URL}")
	endif()
endmacro(sources_url)

