cmake: collect SDL_LIBS as list + export PKG_DIRECTFB_LDFLAGS

This commit is contained in:
Anonymous Maarten 2022-06-15 17:10:31 +02:00 committed by Sam Lantinga
parent b5f1fe5004
commit 18206446bf
2 changed files with 8 additions and 6 deletions

View File

@ -296,7 +296,7 @@ endif()
# Those are used for pkg-config and friends, so that the sdl2.pc, sdl2-config, # Those are used for pkg-config and friends, so that the sdl2.pc, sdl2-config,
# etc. are created correctly. # etc. are created correctly.
set(SDL_LIBS "-lSDL2") set(SDL_LIBS "-lSDL2")
set(SDL_CFLAGS "") set(SDL_CFLAGS )
# When building shared lib for Windows with MinGW, # When building shared lib for Windows with MinGW,
# avoid the DLL having a "lib" prefix # avoid the DLL having a "lib" prefix
@ -321,7 +321,7 @@ if(CYGWIN)
list(APPEND EXTRA_LDFLAGS_BUILD "-mno-cygwin") list(APPEND EXTRA_LDFLAGS_BUILD "-mno-cygwin")
list(APPEND SDL_LIBS "-mno-cygwin") list(APPEND SDL_LIBS "-mno-cygwin")
endif() endif()
set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw") list(APPEND SDL_CFLAGS "-I/usr/include/mingw")
endif() endif()
# General includes # General includes
@ -1859,7 +1859,7 @@ elseif(WINDOWS)
if(MINGW OR CYGWIN) if(MINGW OR CYGWIN)
list(APPEND SDL_LIBS "-lmingw32" "-mwindows") list(APPEND SDL_LIBS "-lmingw32" "-mwindows")
if(NOT SDL2_DISABLE_SDL2MAIN) if(NOT SDL2_DISABLE_SDL2MAIN)
set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main") list(APPEND SDL_CFLAGS "-Dmain=SDL_main")
list(APPEND SDL_LIBS "-lSDL2main") list(APPEND SDL_LIBS "-lSDL2main")
endif(NOT SDL2_DISABLE_SDL2MAIN) endif(NOT SDL2_DISABLE_SDL2MAIN)
endif() endif()
@ -2758,6 +2758,8 @@ Libs.private:")
listtostr(SDL_LIBS _SDL_LIBS) listtostr(SDL_LIBS _SDL_LIBS)
set(SDL_LIBS ${_SDL_LIBS}) set(SDL_LIBS ${_SDL_LIBS})
endif() endif()
listtostr(SDL_CFLAGS _SDL_CFLAGS "")
set(SDL_CFLAGS ${_SDL_CFLAGS})
# MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}")
# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")

View File

@ -733,6 +733,7 @@ macro(CheckDirectFB)
set(SDL_VIDEO_DRIVER_DIRECTFB 1) set(SDL_VIDEO_DRIVER_DIRECTFB 1)
set(SDL_VIDEO_RENDER_DIRECTFB 1) set(SDL_VIDEO_RENDER_DIRECTFB 1)
list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS})
list(APPEND SDL_CFLAGS ${PKG_DIRECTFB_CFLAGS})
if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading") message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
endif() endif()
@ -773,7 +774,7 @@ macro(CheckVivante)
find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED) find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED)
list(APPEND EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY}) list(APPEND EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY})
else() else()
set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB") list(APPEND SDL_CFLAGS -DLINUX -DEGL_API_FB)
list(APPEND EXTRA_LIBS EGL) list(APPEND EXTRA_LIBS EGL)
endif(HAVE_VIVANTE_VDK) endif(HAVE_VIVANTE_VDK)
endif() endif()
@ -921,8 +922,7 @@ macro(CheckPTHREAD)
set(SDL_THREAD_PTHREAD 1) set(SDL_THREAD_PTHREAD 1)
list(APPEND EXTRA_CFLAGS ${PTHREAD_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PTHREAD_CFLAGS})
list(APPEND EXTRA_LDFLAGS ${PTHREAD_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${PTHREAD_LDFLAGS})
set(SDL_CFLAGS "${SDL_CFLAGS} ${PTHREAD_CFLAGS}") list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS})
list(APPEND SDL_LIBS ${PTHREAD_LDFLAGS})
check_c_source_compiles(" check_c_source_compiles("
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1