Commit bab9fbe9 authored by Patrick José Pereira's avatar Patrick José Pereira Committed by Daniel Agar

Joystick: Use find_package for mac and linux

Fix cmake build in macOS
Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent fb42923f
......@@ -24,24 +24,7 @@ target_link_libraries(Joystick
target_include_directories(Joystick PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(LINUX)
find_package(SDL2 REQUIRED)
if (IS_DIRECTORY ${SDL2_INCLUDE_DIRS})
include_directories(${SDL2_INCLUDE_DIRS})
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
target_link_libraries(Joystick PRIVATE ${SDL2_LIBRARIES})
else()
include_directories(${SDL2_DIR})
target_link_libraries(Joystick PRIVATE SDL2::SDL2)
endif()
elseif(APPLE)
include_directories(${CMAKE_SOURCE_DIR}/libs/lib/Frameworks/SDL2.framework/Headers)
target_link_libraries(Joystick PRIVATE -F${CMAKE_SOURCE_DIR}/libs/lib/Frameworks "-framework SDL2")
set_target_properties(Joystick PROPERTIES
MACOSX_BUNDLE YES
)
elseif(WIN32)
if(WIN32)
include_directories(libs/lib/sdl2/msvc/include)
# Support both 32 and 64 bit builds
if (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
......@@ -51,7 +34,16 @@ elseif(WIN32)
endif ()
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
target_link_libraries(Joystick ${SDL2_LIBRARIES})
else()
find_package(SDL2 REQUIRED)
if (IS_DIRECTORY ${SDL2_INCLUDE_DIRS})
include_directories(${SDL2_INCLUDE_DIRS})
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
target_link_libraries(Joystick PRIVATE ${SDL2_LIBRARIES})
else()
include_directories(${SDL2_DIR})
target_link_libraries(Joystick PRIVATE SDL2::SDL2)
endif()
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment