summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-16 15:17:16 -0500
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-11 23:34:14 -0700
commit2f8f8102ac0ea4403243e1bd4a6af750edb8f180 (patch)
tree8c732ef5e2488ab9b53852633d09337a5b03d02a /CMakeLists.txt
parentf263b08d4457e36126f150566219472f3a05c906 (diff)
gc sections from host builds
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c2a9e5..ce1a942 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,12 @@ project(sbc_harness)
pico_sdk_init()
+if ((PICO_PLATFORM STREQUAL "host") AND (NOT PICO_NO_GC_SECTIONS))
+ # On non-host builds, this is done by `pico_standard_link`.
+ add_compile_options(-ffunction-sections -fdata-sections)
+ add_link_options("LINKER:--gc-sections")
+endif()
+
add_compile_options(-Wall -Wextra -Wswitch-enum -Werror)
string(TOUPPER "${CMAKE_BUILD_TYPE}" _upper_cmake_build_type)