mirror of https://github.com/encounter/SDL.git
switch-sdl2: Fix importing SDL2 on platforms that only support static libs
This commit is contained in:
parent
995ae3fbef
commit
cd14a6c0b6
|
@ -18,12 +18,21 @@ if(NOT TARGET SDL2::SDL2)
|
||||||
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ")
|
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ")
|
||||||
string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC)
|
string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC)
|
||||||
|
|
||||||
add_library(SDL2::SDL2 SHARED IMPORTED)
|
if(TARGET_SUPPORTS_SHARED_LIBS)
|
||||||
set_target_properties(SDL2::SDL2 PROPERTIES
|
add_library(SDL2::SDL2 SHARED IMPORTED)
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2"
|
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2"
|
||||||
IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}")
|
IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}")
|
||||||
|
else()
|
||||||
|
add_library(SDL2::SDL2 STATIC IMPORTED)
|
||||||
|
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(SDL2::SDL2-static STATIC IMPORTED)
|
add_library(SDL2::SDL2-static STATIC IMPORTED)
|
||||||
set_target_properties(SDL2::SDL2-static PROPERTIES
|
set_target_properties(SDL2::SDL2-static PROPERTIES
|
||||||
|
|
Loading…
Reference in New Issue