~thestr4ng3r/chiaki

ref: 796a12845684afe5c4b194d4111bcdcf5b04aca2 chiaki/cmake/FindSDL2.cmake -rw-r--r-- 722 bytes
796a1284Florian Märkl Fix fec.c extension 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
find_package(SDL2 NO_MODULE QUIET)

if(SDL2_FOUND AND (NOT TARGET SDL2::SDL2))
	add_library(SDL2::SDL2 UNKNOWN IMPORTED GLOBAL)
	if(NOT SDL2_LIBDIR)
		set(SDL2_LIBDIR "${libdir}")
	endif()
	find_library(SDL2_LIBRARY SDL2 PATHS "${SDL2_LIBDIR}" NO_DEFAULT_PATH)
	if(SDL2_LIBRARY)
		string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
		set_target_properties(SDL2::SDL2 PROPERTIES
				IMPORTED_LOCATION "${SDL2_LIBRARY}"
				IMPORTED_LINK_INTERFACE_LIBRARIES "${SDL2_LIBRARIES}"
				INTERFACE_LINK_DIRECTORIES "${SDL2_LIBDIR}"
				INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}")
	else()
		set(SDL2_FOUND FALSE)
	endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SDL2 CONFIG_MODE)