CMake: Fix link error

Bringing the code coverage option when linking may cause gcc or g++ to automatically link the libgcov.a that comes with the toolchain.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2025-02-19 12:04:52 +08:00 committed by Xiang Xiao
parent a5cb084c1f
commit 7bbb96205b

View file

@ -28,5 +28,10 @@ if(CONFIG_COVERAGE_MINI AND CONFIG_ARCH_TOOLCHAIN_GCC)
target_compile_options(
libcoverage PRIVATE -fno-profile-arcs -fno-test-coverage
-fno-stack-protector)
list(REMOVE_ITEM NUTTX_EXTRA_FLAGS "-fprofile-arcs" "-ftest-coverage"
"-fno-inline")
set_property(GLOBAL PROPERTY NUTTX_EXTRA_FLAGS ${NUTTX_EXTRA_FLAGS})
target_sources(libcoverage PRIVATE gcov.c)
endif()