From 8b59dcfd11a5557a739c36defb0d9854b42edce7 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Tue, 14 Jan 2025 14:55:27 -0800 Subject: [PATCH] cmake: compiler: Check -fno-printf-return-value before using GCC versions before 7.1.0 do not have the -fno-printf-return-value flag and give an error if it is used. This patch improves compatibility with older compilers by making CMake check for the flag's availability before using. Signed-off-by: Joel Holdsworth --- cmake/compiler/gcc/compiler_flags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 15070fe4e93..830d479ee66 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -121,7 +121,7 @@ if (NOT CONFIG_NEWLIB_LIBC AND set_compiler_property(APPEND PROPERTY nostdinc_include ${NOSTDINC}) endif() -set_compiler_property(PROPERTY no_printf_return_value -fno-printf-return-value) +check_set_compiler_property(PROPERTY no_printf_return_value -fno-printf-return-value) set_property(TARGET compiler-cpp PROPERTY nostdincxx "-nostdinc++")