From f7c9502dfbcf6eef85b246780f9a0ef426ed81b2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 20 Mar 2020 12:13:26 -0700 Subject: [PATCH] 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. --- cmake/sdlchecks.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index ee8421fe1..6c33c2569 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -1088,7 +1088,7 @@ macro(CheckHIDAPI) set(HAVE_SDL_JOYSTICK TRUE) file(GLOB HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) 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(HIDAPI_ONLY_LIBUSB) set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)