cmake: add EXTRA_CFLAGS support

Example:

  EXTRA_CFLAGS="-Werror -g0" ./scripts/xtensa-build-all.sh

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2021-09-29 00:27:06 +00:00 committed by Liam Girdwood
parent 771db86de2
commit 83c10268f1
2 changed files with 4 additions and 0 deletions

View File

@ -393,6 +393,7 @@ do
"${MEU_PATH_OPTION}" \ "${MEU_PATH_OPTION}" \
"${PRIVATE_KEY_OPTION}" \ "${PRIVATE_KEY_OPTION}" \
-DINIT_CONFIG=${PLATFORM}${DEFCONFIG_PATCH}_defconfig \ -DINIT_CONFIG=${PLATFORM}${DEFCONFIG_PATCH}_defconfig \
-DEXTRA_CFLAGS="${EXTRA_CFLAGS}" \
"$SOF_TOP" "$SOF_TOP"
) )

View File

@ -119,6 +119,8 @@ target_compile_options(sof_options INTERFACE ${stdlib_flag} -fno-inline-function
# 3) custom function that is used instead of target_sources and sets flags # 3) custom function that is used instead of target_sources and sets flags
# for each added source based on file extension # for each added source based on file extension
separate_arguments(EXTRA_CFLAGS_AS_LIST NATIVE_COMMAND ${EXTRA_CFLAGS})
# No space between -imacros and its argument to avoid CMake # No space between -imacros and its argument to avoid CMake
# de-duplication "feature" # de-duplication "feature"
target_compile_options(sof_options INTERFACE target_compile_options(sof_options INTERFACE
@ -129,6 +131,7 @@ target_compile_options(sof_options INTERFACE
-Wmissing-prototypes -Wmissing-prototypes
-Wpointer-arith -Wpointer-arith
${XTENSA_C_FLAGS} ${XTENSA_C_FLAGS}
${EXTRA_CFLAGS_AS_LIST}
> >
-imacros${CONFIG_H_PATH} -imacros${CONFIG_H_PATH}
) )