diff --git a/components/esp_common/CMakeLists.txt b/components/esp_common/CMakeLists.txt index ba77a6b87f9..1f86d92b9e2 100644 --- a/components/esp_common/CMakeLists.txt +++ b/components/esp_common/CMakeLists.txt @@ -43,3 +43,12 @@ foreach(req ${optional_reqs}) target_link_libraries(${COMPONENT_LIB} PRIVATE ${req_lib}) endif() endforeach() + +if(${IDF_TARGET} STREQUAL "linux" AND CONFIG_ESP_ERR_TO_NAME_LOOKUP) + find_library(LIB_BSD bsd) + if(LIB_BSD) + target_link_libraries(${COMPONENT_LIB} PRIVATE ${LIB_BSD}) + elseif(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + message(WARNING "Missing LIBBSD library. Install libbsd-dev package and/or check linker directories.") + endif() +endif()