1 diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in
2 index db864aab9..b94e16043 100644
3 --- a/sdl2-config.cmake.in
4 +++ b/sdl2-config.cmake.in
5 @@ -26,7 +26,9 @@ set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}")
6 set_and_check(SDL2_BINDIR "${bindir}")
7 set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2")
8 set_and_check(SDL2_LIBDIR "${libdir}")
9 -set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}")
11 +set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}" $ENV{SDL2_PATH})
12 +separate_arguments(SDL2_INCLUDE_DIRS)
14 set(SDL2_LIBRARIES SDL2::SDL2)
15 set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static)
16 diff --git a/sdl2-config.in b/sdl2-config.in
17 index f6eca7668..c0cd94590 100644
20 @@ -46,7 +46,11 @@ while test $# -gt 0; do
24 - echo -I@includedir@/SDL2 @SDL_CFLAGS@
26 + for i in @includedir@/SDL2 $SDL2_PATH; do
27 + SDL_CFLAGS="$SDL_CFLAGS -I$i"
29 + echo $SDL_CFLAGS @SDL_CFLAGS@
31 @ENABLE_SHARED_TRUE@ --libs)
32 @ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@