Fixed bug 5044 - CMake messes up hidapi path when project directory contains spaces

Eric Jing

When the project directory path contains spaces, CMake butchers the include path for the hidapi files.

I traced the problem to the cmake/sdlchecks.cmake file at line 1091, which sets flags for the build process. I surrounded the problem flag with double quotes, shown below, and CMake works with spaces in the project directory path.
This commit is contained in:
Sam Lantinga 2020-03-20 12:13:26 -07:00
parent 5b3b55a181
commit f7c9502dfb
1 changed files with 1 additions and 1 deletions

View File

@ -1088,7 +1088,7 @@ macro(CheckHIDAPI)
set(HAVE_SDL_JOYSTICK TRUE) set(HAVE_SDL_JOYSTICK TRUE)
file(GLOB HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) file(GLOB HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_SOURCES})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} -I${SDL2_SOURCE_DIR}/src/hidapi/hidapi") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} \"-I${SDL2_SOURCE_DIR}/src/hidapi/hidapi\"")
if(NOT HIDAPI_SKIP_LIBUSB) if(NOT HIDAPI_SKIP_LIBUSB)
if(HIDAPI_ONLY_LIBUSB) if(HIDAPI_ONLY_LIBUSB)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c) set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)