From dce00e08c9ef02467d0807c9e2f0455a6901b3e1 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 14 Oct 2024 23:43:49 +0200
Subject: [PATCH] cmake: separate shared and static ldflags for .pc file
---
CMakeLists.txt | 11 +++++++----
sdl2_compat.pc.in | 2 +-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88c5c1b2..79e931c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -446,6 +446,9 @@ if(SDL2COMPAT_INSTALL)
DESTINATION "${SDL2COMPAT_INSTALL_CMAKEDIR}"
)
endforeach()
+ install(FILES "${PROJECT_SOURCE_DIR}/LICENSE.txt"
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/sdl2-compat"
+ )
if(MSVC)
SDL_install_pdb(SDL2 "${CMAKE_INSTALL_BINDIR}")
SDL_install_pdb(SDL2main "${CMAKE_INSTALL_LIBDIR}")
@@ -484,8 +487,8 @@ if(SDL2COMPAT_INSTALL)
if(WIN32)
set(SDL_CFLAGS "")
set(SDL_RLD_FLAGS "")
- set(SDL_LIBS "-lmingw32 -lSDL2main -lshell32 -lSDL2 -mwindows")
- set(SDL_STATIC_LIBS "")
+ set(SDL_LIBS "-lmingw32 -lSDL2main -lSDL2 -mwindows")
+ set(SDL_STATIC_LIBS "-lshell32")
elseif(APPLE)
set(SDL_CFLAGS "-D_THREAD_SAFE")
set(SDL_LIBS "-lSDL2main -lSDL2 -Wl,-framework,Cocoa")
@@ -517,8 +520,8 @@ if(SDL2COMPAT_INSTALL)
configure_file(sdl2_compat.pc.in sdl2_compat.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/sdl2_compat.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
- )
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+ )
configure_file("${CMAKE_SOURCE_DIR}/sdl2-config.in" "${CMAKE_BINARY_DIR}/sdl2-config" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}/sdl2-config" DESTINATION "${CMAKE_INSTALL_BINDIR}")
diff --git a/sdl2_compat.pc.in b/sdl2_compat.pc.in
index c3095ef4..d337137c 100644
--- a/sdl2_compat.pc.in
+++ b/sdl2_compat.pc.in
@@ -10,5 +10,5 @@ Description: An SDL2 compatibility layer that uses SDL3 behind the scenes.
Version: @PROJECT_VERSION@
Provides: sdl2 = @PROJECT_VERSION@
Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@
-@ENABLE_STATIC_TRUE@Libs.private: -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@Libs.private: @SDL_STATIC_LIBS@
Cflags: -I${includedir} -I${includedir}/SDL2 @SDL_CFLAGS@