Commit 867ea2df authored by Chris Rizzitello's avatar Chris Rizzitello Committed by Daniel Agar

Correctly Detect and link SDL2 for linux

parent 8435653f
......@@ -26,9 +26,15 @@ target_include_directories(Joystick PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(LINUX)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES) # work around for cmake warning
target_link_libraries(Joystick PRIVATE ${SDL2_LIBRARIES})
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")
......
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