if(SDL2_FOUND)
	set(SDL2_FIND_QUIETLY TRUE)
endif()

find_path(SDL2_INCLUDE_DIRS NAMES "SDL2/SDL.h" PATHS "${SDL2_ROOT}/include")
find_library(SDL2_LIBRARIES NAMES "SDL2" PATHS "${SDL2_ROOT}/lib")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SDL2 DEFAULT_MSG SDL2_INCLUDE_DIRS SDL2_LIBRARIES)

if(SDL2_FOUND AND NOT TARGET SDL2)
	if(WIN32)
		add_library(SDL2 STATIC IMPORTED)
	else()
		add_library(SDL2 SHARED IMPORTED)
	endif()
	set_target_properties(SDL2 PROPERTIES
		IMPORTED_LOCATION "${SDL2_LIBRARIES}"
		INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
	)
endif()

mark_as_advanced(SDL2_INCLUDE_DIRS SDL2_LIBRARIES)
