From 8486b912281ae85db0c9fc05bb546f16872e114c Mon Sep 17 00:00:00 2001
From: Paulo Neves <ptsneves@gmail.com>
Date: Thu, 28 Jul 2022 14:37:18 +0200
Subject: [PATCH] mbedtls: Do not overwrite CFLAGS

bitbake passes CFLAGS that are often in conflict with the ones set
in mbedtls' CMakeLists.txt. Such conflicts are the inability to use
FORTIFY_SOURCE=2 except in release mode

Upstream status: Innapropriate due to fluent-bit having it's own Release
flags that also overwrite bitbake ones.
---
 lib/mbedtls-2.28.0/CMakeLists.txt | 2 --
 1 file changed, 2 deletions(-)

--- a/lib/mbedtls-2.28.0/CMakeLists.txt
+++ b/lib/mbedtls-2.28.0/CMakeLists.txt
@@ -204,8 +204,6 @@ if(CMAKE_COMPILER_IS_GNU)
     if (GCC_VERSION VERSION_GREATER 7.0 OR GCC_VERSION VERSION_EQUAL 7.0)
       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation")
     endif()
-    set(CMAKE_C_FLAGS_RELEASE     "-O2")
-    set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
     set(CMAKE_C_FLAGS_COVERAGE    "-O0 -g3 --coverage")
     set(CMAKE_C_FLAGS_ASAN        "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3")
     set(CMAKE_C_FLAGS_ASANDBG     "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls")
@@ -215,8 +213,6 @@ endif(CMAKE_COMPILER_IS_GNU)
 
 if(CMAKE_COMPILER_IS_CLANG)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral")
-    set(CMAKE_C_FLAGS_RELEASE     "-O2")
-    set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
     set(CMAKE_C_FLAGS_COVERAGE    "-O0 -g3 --coverage")
     set(CMAKE_C_FLAGS_ASAN        "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3")
     set(CMAKE_C_FLAGS_ASANDBG     "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls")
