cmake: Support installing toolchains in "Program Files"

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 <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2017-12-12 13:54:08 +01:00 committed by Kumar Gala
commit 11c020ebf7

View file

@ -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}")