diff options
| author | Mat M <mathew1800@gmail.com> | 2017-02-06 11:55:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-06 11:55:03 -0500 |
| commit | f978765bf0d1fd5bd934370ec0d4486eb1ea247f (patch) | |
| tree | 05d5c22423e9579f2c973616c98e8ae0aab1ed31 /Source/Core/InputCommon | |
| parent | 02127e360ac24412ba7843b7cebec038faf38dc4 (diff) | |
| parent | a7c4fd9bf0791c0c03b9a8e43cff9f6cafffe9c7 (diff) | |
Merge pull request #4755 from Orphis/cmake_sdl
cmake: Modernize SDL discovery
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/CMakeLists.txt | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index 42907c2941..8a41d101e9 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -51,13 +51,27 @@ if(UNIX) set(SRCS ${SRCS} ControllerInterface/Pipes/Pipes.cpp) endif() -if(SDL_FOUND OR SDL2_FOUND) - set(SRCS ${SRCS} ControllerInterface/SDL/SDL.cpp) - if (SDL2_FOUND) - set(LIBS ${LIBS} ${SDL2_LIBRARY}) - elseif(SDL_FOUND) - set(LIBS ${LIBS} ${SDL_LIBRARY}) +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() add_dolphin_library(inputcommon "${SRCS}" "${LIBS}") |
