CMake: make option ENABLE_SDL work again

Broken in PR #4755 / commit f978765
This commit is contained in:
Michael Maltese 2017-02-06 20:59:56 -08:00
parent bdf09c7d3b
commit fc0d88817f
1 changed files with 22 additions and 20 deletions

View File

@ -51,27 +51,29 @@ if(UNIX)
set(SRCS ${SRCS} ControllerInterface/Pipes/Pipes.cpp) set(SRCS ${SRCS} ControllerInterface/Pipes/Pipes.cpp)
endif() endif()
find_package(SDL2) if(ENABLE_SDL)
if(SDL2_FOUND) find_package(SDL2)
message(STATUS "Using shared SDL2") if(SDL2_FOUND)
set(SDL_TARGET SDL2::SDL2) message(STATUS "Using shared SDL2")
else() set(SDL_TARGET SDL2::SDL2)
# SDL2 not found, try SDL else()
find_package(SDL) # SDL2 not found, try SDL
if(SDL_FOUND) find_package(SDL)
message(STATUS "Using shared SDL") if(SDL_FOUND)
add_library(System_SDL INTERFACE) message(STATUS "Using shared SDL")
target_include_directories(System_SDL INTERFACE ${SDL_INCLUDE_DIR}) add_library(System_SDL INTERFACE)
target_link_libraries(System_SDL INTERFACE ${SDL_LIBRARY}) target_include_directories(System_SDL INTERFACE ${SDL_INCLUDE_DIR})
set(SDL_TARGET System_SDL) 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()
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()
add_dolphin_library(inputcommon "${SRCS}" "${LIBS}") add_dolphin_library(inputcommon "${SRCS}" "${LIBS}")