cmake: always create SDL2::SDL2main target in autotools' cmake config script

This commit is contained in:
Anonymous Maarten 2022-08-24 04:14:52 +02:00 committed by Sam Lantinga
parent dc2ef31c29
commit 5eb0f4328d
1 changed files with 29 additions and 28 deletions

View File

@ -62,8 +62,10 @@ string(REGEX REPLACE ";-L" ";" _sdl2_static_private_libdirs "${_sdl2_static_priv
if(_sdl2_libraries MATCHES ".*SDL2main.*") if(_sdl2_libraries MATCHES ".*SDL2main.*")
list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main)
list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main)
set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}) endif()
if(EXISTS "${_sdl2main_library}")
set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX})
if(EXISTS "${_sdl2main_library}")
set(SDL2MAIN_LIBRARY SDL2::SDL2main) set(SDL2MAIN_LIBRARY SDL2::SDL2main)
if(NOT TARGET SDL2::SDL2main) if(NOT TARGET SDL2::SDL2main)
add_library(SDL2::SDL2main STATIC IMPORTED) add_library(SDL2::SDL2main STATIC IMPORTED)
@ -89,11 +91,10 @@ if(_sdl2_libraries MATCHES ".*SDL2main.*")
endif() endif()
endif() endif()
set(SDL2_SDL2main_FOUND TRUE) set(SDL2_SDL2main_FOUND TRUE)
else() else()
set(SDL2_SDL2main_FOUND FALSE) set(SDL2_SDL2main_FOUND FALSE)
endif()
unset(_sdl2main_library)
endif() endif()
unset(_sdl2main_library)
# Remove SDL2 since this is the "central" library # Remove SDL2 since this is the "central" library
# Remove SDL2main since this will be provided by SDL2::SDL2main (if available) # Remove SDL2main since this will be provided by SDL2::SDL2main (if available)