2015-06-30 05:24:00 +00:00
|
|
|
# sdl2 cmake project-config input for ./configure scripts
|
|
|
|
|
|
|
|
set(prefix "@prefix@")
|
|
|
|
set(exec_prefix "@exec_prefix@")
|
2015-12-29 04:29:11 +00:00
|
|
|
set(libdir "@libdir@")
|
2021-04-21 04:27:41 +00:00
|
|
|
set(includedir "@includedir@")
|
|
|
|
set(SDL2_PREFIX "${prefix}")
|
|
|
|
set(SDL2_EXEC_PREFIX "${exec_prefix}")
|
|
|
|
set(SDL2_LIBDIR "${libdir}")
|
|
|
|
set(SDL2_INCLUDE_DIRS "${includedir}/SDL2")
|
2015-06-30 05:24:00 +00:00
|
|
|
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
|
2016-10-07 22:08:37 +00:00
|
|
|
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
2020-02-21 20:52:35 +00:00
|
|
|
|
|
|
|
if(NOT TARGET SDL2::SDL2)
|
|
|
|
# Remove -lSDL2 as that is handled by CMake, note the space at the end so it does not replace e.g. -lSDL2main
|
|
|
|
# This may require "libdir" beeing set (from above)
|
|
|
|
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS "@SDL_RLD_FLAGS@ @SDL_LIBS@ ")
|
|
|
|
string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS)
|
2020-04-11 22:38:34 +00:00
|
|
|
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ")
|
2020-02-21 20:52:35 +00:00
|
|
|
string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC)
|
|
|
|
|
|
|
|
add_library(SDL2::SDL2 SHARED IMPORTED)
|
|
|
|
set_target_properties(SDL2::SDL2 PROPERTIES
|
2021-04-21 04:27:41 +00:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
2020-02-21 20:52:35 +00:00
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
2020-03-17 07:46:34 +00:00
|
|
|
IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
2021-04-18 04:23:20 +00:00
|
|
|
# TODO: on windows set IMPORTED_IMPLIB to SDL2.lib
|
|
|
|
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") # TODO: really? SDL2Config.cmake doesn't do this
|
2020-02-21 20:52:35 +00:00
|
|
|
|
|
|
|
add_library(SDL2::SDL2-static STATIC IMPORTED)
|
|
|
|
set_target_properties(SDL2::SDL2-static PROPERTIES
|
2021-04-21 04:27:41 +00:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
2020-02-21 20:52:35 +00:00
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
2021-04-21 04:27:41 +00:00
|
|
|
IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
2020-02-21 20:52:35 +00:00
|
|
|
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}")
|
|
|
|
|
|
|
|
add_library(SDL2::SDL2main STATIC IMPORTED)
|
|
|
|
set_target_properties(SDL2::SDL2main PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
2020-03-17 07:46:34 +00:00
|
|
|
IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
2020-02-21 20:52:35 +00:00
|
|
|
endif()
|