Skip to content

Commit

Permalink
CMake: Fix SDL2 include directory
Browse files Browse the repository at this point in the history
Since SDL includes its own CMake config since version 2.0.4, which takes
precedence over our FindSDL2.cmake script if present. This is mostly a
good thing except for the SDL2 config defining SDL2_INCLUDE_DIRS only
whereas we used SDL2_INCLUDE_DIR. Fix that mismatch.
  • Loading branch information
dscharrer committed Aug 16, 2021
1 parent 7e74bfb commit e37929a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ find_package(PythonInterp)
if(ARX_HAVE_SDL AND ARX_HAVE_OPENGL AND NOT WIN32 AND NOT APPLE)
set(old_CMAKE_REQUIRED_INCLUDES)
if(ARX_HAVE_SDL2)
set(CMAKE_REQUIRED_INCLUDES ${SDL2_INCLUDE_DIR})
set(CMAKE_REQUIRED_INCLUDES ${SDL2_INCLUDE_DIRS})
else()
set(CMAKE_REQUIRED_INCLUDES ${SDL_INCLUDE_DIR})
endif()
Expand Down Expand Up @@ -1289,7 +1289,7 @@ if(ARX_HAVE_SDL)
list(APPEND WINDOW_SOURCES ${WINDOW_SDL2_SOURCES})
list(APPEND INPUT_SOURCES ${INPUT_SDL2_SOURCES})
list(APPEND ARX_LIBRARIES ${SDL2_LIBRARIES})
include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
elseif(ARX_HAVE_SDL1)
list(APPEND WINDOW_SOURCES ${WINDOW_SDL1_SOURCES})
list(APPEND INPUT_SOURCES ${INPUT_SDL1_SOURCES})
Expand Down
1 change: 1 addition & 0 deletions cmake/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ find_package_handle_standard_args(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_D

if(SDL2_LIBRARY)

set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
set(SDL2_LIBRARIES ${SDL2_LIBRARY})

# If we're linking against a static libSDL2 we also need to link against some other
Expand Down

0 comments on commit e37929a

Please sign in to comment.