1idf_build_get_property(target IDF_TARGET)
2
3if(${target} STREQUAL "linux")
4    set(ldfragments)
5    set(srcs "src/esp_err_check_linux.c")
6else()
7    set(ldfragments common.lf soc.lf)
8    set(srcs)
9endif()
10
11list(APPEND srcs "src/esp_err_to_name.c")
12
13# Note: esp_ipc, esp_pm added as a public requirement to keep compatibility as to be located here.
14idf_component_register(SRCS "${srcs}"
15                        INCLUDE_DIRS include
16                        LDFRAGMENTS ${ldfragments})
17
18set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 4)
19
20# List of components needed for the error codes list
21set(optional_reqs ulp
22                    efuse
23                    esp_http_client
24                    esp_http_server
25                    bootloader_support
26                    nvs_flash
27                    esp_wifi
28                    app_update
29                    lwip
30                    spi_flash
31                    wpa_supplicant
32                    esp_serial_slave_link
33                    esp_netif
34                    soc
35                    esp-tls
36                    esp_https_ota
37                    esp_hw_support)
38
39idf_build_get_property(build_components BUILD_COMPONENTS)
40foreach(req ${optional_reqs})
41    if(req IN_LIST build_components)
42        idf_component_get_property(req_lib ${req} COMPONENT_LIB)
43        target_link_libraries(${COMPONENT_LIB} PRIVATE ${req_lib})
44    endif()
45endforeach()
46