Browse Source

fix "Unknown arguments specified" cmake error

In some environments, "${SDL2_INCLUDE_DIRS}" can be expanded into multiple parameters, which will cause more than 2 parameters to appear in the if statement.

```
CMake Error at src/Joystick/CMakeLists.txt:41 (if):                                                                                                                                                                                           
  if given arguments:                                                                                                                                                                                                                         
                                                                                                                                                                                                                                              
    "IS_DIRECTORY" "/usr/include" "/usr/include/SDL2"                                                                                                                                                                                         
                                                                                                                                                                                                                                              
  Unknown arguments specified                                                                                                                                                                                                                 
```
QGC4.4
小光 4 years ago committed by Patrick José Pereira
parent
commit
83f16abf55
  1. 2
      src/Joystick/CMakeLists.txt

2
src/Joystick/CMakeLists.txt

@ -28,7 +28,7 @@ if(WIN32) @@ -28,7 +28,7 @@ if(WIN32)
target_link_libraries(Joystick PUBLIC sdl2)
else()
find_package(SDL2 REQUIRED)
if (IS_DIRECTORY ${SDL2_INCLUDE_DIRS})
if (IS_DIRECTORY "${SDL2_INCLUDE_DIRS}")
include_directories(${SDL2_INCLUDE_DIRS})
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
target_link_libraries(Joystick PRIVATE ${SDL2_LIBRARIES})

Loading…
Cancel
Save