From 11c020ebf75ccd3502ec0731ce5a356531ee1f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Tue, 12 Dec 2017 13:54:08 +0100 Subject: [PATCH] cmake: Support installing toolchains in "Program Files" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support installing toolchains in "Program Files", or more generally, in paths that contain whitespace. This is a common bug for new users to discover. Signed-off-by: Sebastian Bøe --- cmake/toolchain-gcc.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/toolchain-gcc.cmake b/cmake/toolchain-gcc.cmake index e81282c29c5..b1f9b650edf 100644 --- a/cmake/toolchain-gcc.cmake +++ b/cmake/toolchain-gcc.cmake @@ -90,11 +90,11 @@ get_filename_component(LIBGCC_DIR ${LIBGCC_DIR} DIRECTORY) assert(LIBGCC_DIR "LIBGCC_DIR not found") -LIST(APPEND LIB_INCLUDE_DIR -L${LIBGCC_DIR}) +LIST(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"") LIST(APPEND TOOLCHAIN_LIBS gcc) set(LIBC_INCLUDE_DIR ${SYSROOT_DIR}/include) -set(LIBC_LIBRARY_DIR ${SYSROOT_DIR}/lib/${NEWLIB_DIR}) +set(LIBC_LIBRARY_DIR "\"${SYSROOT_DIR}\"/lib/${NEWLIB_DIR}") # For CMake to be able to test if a compiler flag is supported by the # toolchain we need to give CMake the necessary flags to compile and @@ -103,7 +103,7 @@ set(LIBC_LIBRARY_DIR ${SYSROOT_DIR}/lib/${NEWLIB_DIR}) # CMake checks compiler flags with check_c_compiler_flag() (Which we # wrap with target_cc_option() in extentions.cmake) foreach(isystem_include_dir ${NOSTDINC}) - list(APPEND isystem_include_flags -isystem ${isystem_include_dir}) + list(APPEND isystem_include_flags -isystem "\"${isystem_include_dir}\"") endforeach() set(CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags} -Wl,--unresolved-symbols=ignore-in-object-files) string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")