mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-30 15:23:28 +08:00
3ea11f9acb
still WIP and other platforms than windows still TODO and open questions etc see https://github.com/libsdl-org/SDL/issues/4004
41 lines
1.9 KiB
CMake
41 lines
1.9 KiB
CMake
# sdl2 cmake project-config input for ./configure scripts
|
|
|
|
set(prefix "@prefix@")
|
|
set(exec_prefix "@exec_prefix@")
|
|
set(libdir "@libdir@")
|
|
set(SDL2_PREFIX "@prefix@")
|
|
set(SDL2_EXEC_PREFIX "@prefix@")
|
|
set(SDL2_LIBDIR "@libdir@")
|
|
set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
|
|
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
|
|
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
|
|
|
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)
|
|
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ")
|
|
string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC)
|
|
|
|
add_library(SDL2::SDL2 SHARED IMPORTED)
|
|
set_target_properties(SDL2::SDL2 PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2"
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
|
# TODO: on windows set IMPORTED_IMPLIB to SDL2.lib
|
|
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") # TODO: really? SDL2Config.cmake doesn't do this
|
|
|
|
add_library(SDL2::SDL2-static STATIC IMPORTED)
|
|
set_target_properties(SDL2::SDL2-static 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}")
|
|
|
|
add_library(SDL2::SDL2main STATIC IMPORTED)
|
|
set_target_properties(SDL2::SDL2main PROPERTIES
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
endif()
|