cmake: rename cmake variables to include _PC_ as they are meant for pkgconfig file

This commit is contained in:
Anonymous Maarten 2023-01-07 16:24:11 +01:00 committed by Anonymous Maarten
parent 373a6464c8
commit 0a4420e02f
3 changed files with 15 additions and 16 deletions

View File

@ -263,8 +263,8 @@ if(MSVC)
endif()
# Those are used for pkg-config so sdl3.pc is created correctly.
set(SDL_LIBS "-lSDL3")
set(SDL_CFLAGS )
set(SDL_PC_LIBS "-lSDL3")
set(SDL_PC_CFLAGS )
# When building shared lib for Windows with MinGW,
# avoid the DLL having a "lib" prefix
@ -291,9 +291,9 @@ if(CYGWIN)
cmake_pop_check_state()
if(HAVE_GCC_NO_CYGWIN)
list(APPEND EXTRA_LDFLAGS_BUILD "-mno-cygwin")
list(APPEND SDL_LIBS "-mno-cygwin")
list(APPEND SDL_PC_LIBS "-mno-cygwin")
endif()
list(APPEND SDL_CFLAGS "-I/usr/include/mingw")
list(APPEND SDL_PC_CFLAGS "-I/usr/include/mingw")
endif()
# General includes
@ -1953,7 +1953,7 @@ elseif(WINDOWS)
file(GLOB VERSION_SOURCES ${SDL3_SOURCE_DIR}/src/core/windows/*.rc)
if(MINGW OR CYGWIN)
list(INSERT SDL_LIBS 0 "-lmingw32" "-mwindows")
list(INSERT SDL_PC_LIBS 0 "-lmingw32" "-mwindows")
endif()
elseif(APPLE)
@ -2916,21 +2916,20 @@ set(SDL_STATIC_LIBS ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
listtostr(SDL_LIBS _SDL_LIBS)
set(SDL_LIBS ${_SDL_LIBS})
listtostr(SDL_CFLAGS _SDL_CFLAGS "")
set(SDL_CFLAGS ${_SDL_CFLAGS})
listtostr(SDL_PC_LIBS SDL_PC_LIBS)
listtostr(SDL_PC_CFLAGS SDL_PC_CFLAGS)
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_STATIC_LIBS "${SDL_STATIC_LIBS}")
if(NOT SDL_SHARED)
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}")
string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_PC_LIBS "${SDL_PC_LIBS}")
endif()
if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL3")
message(STATUS "\"pkg-config --static --libs sdl3\" will return invalid information")
endif()
# MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}")
# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")
# message(STATUS "SDL_PC_CFLAGS: ${SDL_PC_CFLAGS}")
# message(STATUS "SDL_PC_LIBS: ${SDL_PC_LIBS}")
# message(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")
configure_file(cmake/sdl3.pc.in sdl3.pc @ONLY)

View File

@ -10,5 +10,5 @@ Description: Simple DirectMedia Layer is a cross-platform multimedia library des
Version: @SDL_VERSION@
Requires.private: @PKGCONFIG_DEPENDS@
Conflicts:
Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@
Cflags: -I${includedir} -I${includedir}/SDL3 @SDL_CFLAGS@
Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_PC_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@
Cflags: -I${includedir} -I${includedir}/SDL3 @SDL_PC_CFLAGS@

View File

@ -661,7 +661,7 @@ macro(CheckVivante)
find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED)
list(APPEND EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY})
else()
list(APPEND SDL_CFLAGS -DLINUX -DEGL_API_FB)
list(APPEND SDL_PC_CFLAGS -DLINUX -DEGL_API_FB)
list(APPEND EXTRA_LIBS EGL)
endif(HAVE_VIVANTE_VDK)
endif()
@ -808,7 +808,7 @@ macro(CheckPTHREAD)
set(SDL_THREAD_PTHREAD 1)
target_compile_options(sdl-build-options INTERFACE ${PTHREAD_CFLAGS})
list(APPEND EXTRA_LDFLAGS ${PTHREAD_LDFLAGS})
list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS})
list(APPEND SDL_PC_CFLAGS ${PTHREAD_CFLAGS})
check_c_source_compiles("
#define _GNU_SOURCE 1