nixpkgs/pkgs/development/libraries/SDL2/find-headers.patch
2022-09-18 12:01:52 -03:00

33 lines
1.1 KiB
Diff

diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in
index db864aab9..b94e16043 100644
--- a/sdl2-config.cmake.in
+++ b/sdl2-config.cmake.in
@@ -26,7 +26,9 @@ set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}")
set_and_check(SDL2_BINDIR "${bindir}")
set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2")
set_and_check(SDL2_LIBDIR "${libdir}")
-set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}")
+
+set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}" $ENV{SDL2_PATH})
+separate_arguments(SDL2_INCLUDE_DIRS)
set(SDL2_LIBRARIES SDL2::SDL2)
set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static)
diff --git a/sdl2-config.in b/sdl2-config.in
index f6eca7668..c0cd94590 100644
--- a/sdl2-config.in
+++ b/sdl2-config.in
@@ -46,7 +46,11 @@ while test $# -gt 0; do
echo @SDL_VERSION@
;;
--cflags)
- echo -I@includedir@/SDL2 @SDL_CFLAGS@
+ SDL_CFLAGS=""
+ for i in @includedir@/SDL2 $SDL2_PATH; do
+ SDL_CFLAGS="$SDL_CFLAGS -I$i"
+ done
+ echo $SDL_CFLAGS @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@