diff --git a/components/app_trace/CMakeLists.txt b/components/app_trace/CMakeLists.txt index 9cb36c8f04..b4c6cf55e9 100644 --- a/components/app_trace/CMakeLists.txt +++ b/components/app_trace/CMakeLists.txt @@ -54,13 +54,15 @@ idf_component_register(SRCS "${srcs}" REQUIRES esp_timer LDFRAGMENTS linker.lf) -# disable --coverage for this component, as it is used as transport -# for gcov -target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage") - -# Force app_trace to also appear later than gcov in link line -idf_component_get_property(app_trace app_trace COMPONENT_LIB) -target_link_libraries(${COMPONENT_LIB} INTERFACE $ gcov $ c) +if(CONFIG_APPTRACE_GCOV_ENABLE) + # disable --coverage for this component, as it is used as transport + # for gcov + target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage") + # Force app_trace to also appear later than gcov in link line + idf_component_get_property(app_trace app_trace COMPONENT_LIB) + target_link_libraries(${COMPONENT_LIB} INTERFACE + "-Wl,--undefined=gcov_rtio_atexit" $ gcov $ c) +endif() # This function adds a dependency on the given component if the component is included into the build. function(maybe_add_component component_name)