summaryrefslogtreecommitdiff
path: root/examples/build_system
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-10-14 17:13:28 +0700
committerhathach <[email protected]>2025-10-14 17:13:28 +0700
commit47b13f6b102ea981b79588158dca436ebc21f1ae (patch)
treee435b6af711f0386daec3eb53313cf4c2c240735 /examples/build_system
parent9bf18d080b202e8e09bd76f32272b1dbfabfa3b9 (diff)
improve cmake warning flags, fix various warnings in examples
Diffstat (limited to 'examples/build_system')
-rw-r--r--examples/build_system/cmake/toolchain/common.cmake17
1 files changed, 2 insertions, 15 deletions
diff --git a/examples/build_system/cmake/toolchain/common.cmake b/examples/build_system/cmake/toolchain/common.cmake
index 4c181137b..fa3034e6f 100644
--- a/examples/build_system/cmake/toolchain/common.cmake
+++ b/examples/build_system/cmake/toolchain/common.cmake
@@ -20,11 +20,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_CPU}.cmake)
# ----------------------------------------------------------------------------
# Compile flags
# ----------------------------------------------------------------------------
-if (TOOLCHAIN STREQUAL "gcc")
+if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang")
list(APPEND TOOLCHAIN_COMMON_FLAGS
-fdata-sections
-ffunction-sections
- -fsingle-precision-constant
+# -fsingle-precision-constant # not supported by clang
-fno-strict-aliasing
)
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
@@ -34,22 +34,9 @@ if (TOOLCHAIN STREQUAL "gcc")
)
elseif (TOOLCHAIN STREQUAL "iar")
- #list(APPEND TOOLCHAIN_COMMON_FLAGS)
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
--diag_suppress=Li065
)
-
-elseif (TOOLCHAIN STREQUAL "clang")
- list(APPEND TOOLCHAIN_COMMON_FLAGS
- -fdata-sections
- -ffunction-sections
- -fno-strict-aliasing
- )
- list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
- -Wl,--print-memory-usage
- -Wl,--gc-sections
- -Wl,--cref
- )
endif ()
# join the toolchain flags into a single string