mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Fix SDL2 if Target unavailable
This commit is contained in:
parent
84756ba8ef
commit
851593d5df
2 changed files with 20 additions and 1 deletions
19
cmake/FindSDL2.cmake
Normal file
19
cmake/FindSDL2.cmake
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
find_package(SDL2 NO_MODULE QUIET)
|
||||
|
||||
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
|
||||
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
|
||||
find_library(SDL2_LIBRARY SDL2 PATHS "${SDL2_LIBDIR}" NO_DEFAULT_PATH)
|
||||
if(SDL2_LIBRARY)
|
||||
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 DEFAULT_MSG)
|
Loading…
Add table
Add a link
Reference in a new issue