How do I refer to a library in libdeps from an ESP-IDF-component in /components?

H!

I am having issues with using RadioLib as I can’t seem to include it from components.
Example: GitHub - nicklasb/RadioLib_PIO_ESPIDF

Adding an idf_component.yml to the component makes it conflict with the “project(radiolib)” syntax in its CMakeLists.txt. And cant seem to REQUIRES it under any of the names I have tried.

Any ideas? I realize that components needs to be self-contained and have their own idf_component.yml.
But can I do something, or does RadioLib need to change something to make the managed_components work?

Hm, it may not be a supported use case to create a ESP-IDF component in which you can use libraries included via lib_deps… (you can ask the developers that at https://github.com/platformio/platform-espressif32/issues) I think if you created is a “regular” library in lib/<your libry name> you could use the library normally. Or converting the RadioLib to an ESP-IDF component by giving it a CMakeLists.txt appropriate for ESP-IDF might work too.

Ok, I see, I will see what route I’ll go.
Thanks for your response!

@maxgerhardt Hi, RadioLib maintainer here!

Or converting the RadioLib to an ESP-IDF component by giving it a CMakeLists.txt appropriate for ESP-IDF might work too

Is there any example/tutorial/template CMakeLists for ESP-IDF-compatible components? I’m asking because I was able to use RadioLib with ESP-IDF (albeit without platformio), so maybe there’s something I’m missing. Thanks!

Well the CMakeLists.txt for a ESP-IDF can range from really trivial

to something slightly more complex

This is at best though a workaround. You already have a CMakeLists.txt in the project, replacing it wouldn’t be good. PlatformIO devs should build something that allows ESP-IDF components placed in a PlatformIO project to access the lib_deps included included libraries and vice-versa, if it isn’t already there, I haven’t looked into this personally, but from the current report it seems so.

@maxgerhardt thanks - from your examples I gather that idf_component_register is always needed. I guess that could be an issue for platforms that don’t have ESP-IDF installed at all. We’ll keep investigating this.

Could one do something with conditionals?
I mean, is there a way to know if the CMakeText.txt is evaluated as a project or as a component?