From e53c0d0ec7640bd24efb16286a2cbc9a72ebcbf6 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 2 Jul 2019 16:09:47 -0400 Subject: [PATCH] cmake: toolchain_cc_imacros: don't use the long argument form Commit f57ba2d30c2d ("cmake: toolchain_cc_imacros: don't use space separated arguments") moved toolchain_cc_imacros() to using the long argument format in order to avoid spaces that CMake uses to delimitate and deduplicate arguments. It seems that xcc doesn't support the --imacros=foo form. However it does support the short "combined" -imacrosfoo form (without space). So let's use that instead and document the caviat. Signed-off-by: Nicolas Pitre --- cmake/compiler/gcc/target_imacros.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/compiler/gcc/target_imacros.cmake b/cmake/compiler/gcc/target_imacros.cmake index 804040411c5..0fba83819af 100644 --- a/cmake/compiler/gcc/target_imacros.cmake +++ b/cmake/compiler/gcc/target_imacros.cmake @@ -4,6 +4,12 @@ macro(toolchain_cc_imacros header_file) - zephyr_compile_options(--imacros=${header_file}) + # We cannot use the "-imacros foo" form here as CMake insists on + # deduplicating arguments, meaning that subsequent usages after the + # first one will see the "-imacros " part removed. + # gcc and clang support the "--imacros=foo" form but not xcc. + # Let's use the "combined" form (without space) which is supported + # by everyone so far. + zephyr_compile_options(-imacros${header_file}) endmacro()