From 3c9463bc7500040fedbcb8884203bbd07ad656c0 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Tue, 27 Feb 2024 16:50:59 +0800 Subject: [PATCH] fix(linux_target): fix esp_err_to_name failing to compile on linux --- components/esp_common/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/esp_common/CMakeLists.txt b/components/esp_common/CMakeLists.txt index ba77a6b87f..1f86d92b9e 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()