Linking component to the pure cmake library in idf project

Mishok
Posts: 1
Joined: Thu Jan 11, 2024 5:36 pm

Linking component to the pure cmake library in idf project

Postby Mishok » Thu Jan 11, 2024 5:41 pm

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.

Who is online

Users browsing this forum: Baidu [Spider] and 105 guests