cmake: toolchain: Fix 'host' toolchain variant

Fix an issue with 'ZEPHYR_TOOLCHAIN_VARIANT=host' where CMAKE_C_FLAGS
was incorrectly assumed to be set.

This fixes #21614

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2019-12-31 12:01:36 +01:00 committed by Anas Nashif
commit d385d86f74

View file

@ -23,10 +23,10 @@ find_program(CMAKE_CXX_COMPILER ${cplusplus_compiler} CACHE INTERNAL " " FOR
# that is currently not needed. See comments in compiler/gcc/target.cmake # that is currently not needed. See comments in compiler/gcc/target.cmake
if (CONFIG_X86) if (CONFIG_X86)
# Convert to list as cmake Modules/*.cmake do it # Convert to list as cmake Modules/*.cmake do it
STRING(REGEX REPLACE " +" ";" PRINT_LIBGCC_ARGS ${CMAKE_C_FLAGS}) STRING(REGEX REPLACE " +" ";" PRINT_LIBGCC_ARGS "${CMAKE_C_FLAGS}")
# This libgcc code is partially duplicated in compiler/*/target.cmake # This libgcc code is partially duplicated in compiler/*/target.cmake
execute_process( execute_process(
COMMAND ${CMAKE_C_COMPILER} ${PRINT_LIBGCC_ARGS} --print-libgcc-file-name COMMAND ${CMAKE_C_COMPILER} "${PRINT_LIBGCC_ARGS}" --print-libgcc-file-name
OUTPUT_VARIABLE LIBGCC_FILE_NAME OUTPUT_VARIABLE LIBGCC_FILE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )