You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.8 KiB
39 lines
1.8 KiB
# sdl2 cmake project-config input for ./configure scripts |
|
|
|
set(prefix "/usr/local") |
|
set(exec_prefix "${prefix}") |
|
set(libdir "${exec_prefix}/lib") |
|
set(SDL2_PREFIX "/usr/local") |
|
set(SDL2_EXEC_PREFIX "/usr/local") |
|
set(SDL2_LIBDIR "${exec_prefix}/lib") |
|
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2") |
|
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -Wl,-rpath,${libdir} -Wl,--enable-new-dtags -lSDL2") |
|
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 "-Wl,-rpath,${libdir} -Wl,--enable-new-dtags -lSDL2 ") |
|
string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS) |
|
string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "-Wl,-rpath,${libdir} -Wl,--enable-new-dtags -lSDL2 -Wl,--no-undefined -lm -ldl -lpthread -lrt ") |
|
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 "${prefix}/include/SDL2" |
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
|
IMPORTED_LOCATION "${exec_prefix}/lib/libSDL2.so" |
|
INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") |
|
|
|
add_library(SDL2::SDL2-static STATIC IMPORTED) |
|
set_target_properties(SDL2::SDL2-static PROPERTIES |
|
INTERFACE_INCLUDE_DIRECTORIES "${prefix}/include/SDL2" |
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
|
IMPORTED_LOCATION "${exec_prefix}/lib/libSDL2.a" |
|
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 "${exec_prefix}/lib/libSDL2main.a") |
|
endif()
|
|
|