Page 1 of 1

Linking component to the pure cmake library in idf project

Posted: Thu Jan 11, 2024 5:41 pm
by Mishok
Hello

I have a custom idf component which has to be used in static cmake library.
I use the static library in idf project.

idf_custom_library/CMakeLists.txt
idf_component_register(...)

static_component/CMakeLists.txt
add_library(static_component ...)
target_link_libraries(static_component idf_custom_library)

main/CMakeLists.txt
idf_component_register(...)
target_link_libraries(${COMPONENT_LIB} static_component)

I can't link the libraries as such an error is appearing.
Target "idf_custom_library" of type UTILITY may not be linked into another target. One
may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.