Skip to content

Commit

Permalink
Merge pull request #4843 from ligfx/enable_Sdl
Browse files Browse the repository at this point in the history
CMake: make option ENABLE_SDL work again
  • Loading branch information
lioncash committed Feb 7, 2017
2 parents bdf09c7 + fc0d888 commit f5e940d
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions Source/Core/InputCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,29 @@ if(UNIX)
set(SRCS ${SRCS} ControllerInterface/Pipes/Pipes.cpp)
endif()

find_package(SDL2)
if(SDL2_FOUND)
message(STATUS "Using shared SDL2")
set(SDL_TARGET SDL2::SDL2)
else()
# SDL2 not found, try SDL
find_package(SDL)
if(SDL_FOUND)
message(STATUS "Using shared SDL")
add_library(System_SDL INTERFACE)
target_include_directories(System_SDL INTERFACE ${SDL_INCLUDE_DIR})
target_link_libraries(System_SDL INTERFACE ${SDL_LIBRARY})
set(SDL_TARGET System_SDL)
if(ENABLE_SDL)
find_package(SDL2)
if(SDL2_FOUND)
message(STATUS "Using shared SDL2")
set(SDL_TARGET SDL2::SDL2)
else()
# SDL2 not found, try SDL
find_package(SDL)
if(SDL_FOUND)
message(STATUS "Using shared SDL")
add_library(System_SDL INTERFACE)
target_include_directories(System_SDL INTERFACE ${SDL_INCLUDE_DIR})
target_link_libraries(System_SDL INTERFACE ${SDL_LIBRARY})
set(SDL_TARGET System_SDL)
endif()
endif()
if(SDL_TARGET AND TARGET ${SDL_TARGET})
set(SRCS ${SRCS} ControllerInterface/SDL/SDL.cpp)
set(LIBS ${LIBS} ${SDL_TARGET})
add_definitions(-DHAVE_SDL=1)
else()
message(STATUS "SDL NOT found, disabling SDL input")
endif()
endif()
if(SDL_TARGET AND TARGET ${SDL_TARGET})
set(SRCS ${SRCS} ControllerInterface/SDL/SDL.cpp)
set(LIBS ${LIBS} ${SDL_TARGET})
add_definitions(-DHAVE_SDL=1)
else()
message(STATUS "SDL NOT found, disabling SDL input")
endif()

add_dolphin_library(inputcommon "${SRCS}" "${LIBS}")

0 comments on commit f5e940d

Please sign in to comment.