Browse Source

Correctly Detect and link SDL2 for linux

QGC4.4
Chris Rizzitello 6 years ago committed by Daniel Agar
parent
commit
867ea2dfcf
  1. 12
      src/Joystick/CMakeLists.txt

12
src/Joystick/CMakeLists.txt

@ -26,9 +26,15 @@ target_include_directories(Joystick PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) @@ -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")

Loading…
Cancel
Save