ESP Component publishing: help with the structure

Boschi
Posts: 1
Joined: Wed Mar 04, 2026 9:34 pm

ESP Component publishing: help with the structure

Postby Boschi » Wed Mar 04, 2026 10:36 pm

Hi All, this is my first time posting here.
I'm not a professional developer, and i just picked an ESP32 to develop a small project of mine.
Currently i wanted to develop a library for an SPS30 device, I did so by modifying and cleaning an example I2C project, and after cleaning up the code I'm ready to publish it on the ESP component registry, but after following the following guide: https://docs.espressif.com/projects/idf ... pload.html
I'm still not sure that everything is ok.

The code is here: https://github.com/TheBigBoschi/sps30

Mainly, following the steps in the readme file (written by an AI, shameful I know, but better than being completely stuck) I try to build the project, but i get "CMake Error at CMakeLists.txt:3 (idf_component_register): Unknown CMake command "idf_component_register", after some googling I'm still stuck.
Other than that, did I miss anything else? Mainly CMake related stuff, I'm still getting the hang of it.

Please feel free to look at the code and comment on how it could be improved, I really appreciate it.

MicroController
Posts: 2669
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP Component publishing: help with the structure

Postby MicroController » Thu Mar 05, 2026 8:06 am

You need a project to build a component. The project's CMakeLists.txt has to

Code: Select all

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
in order to make the IDF CMake functions, like idf_component_register(), available.

The regular structure is that you have a project, which represents an application or less commonly a static library. By default, that project builds a component called "main", and that component pulls in all other components the project REQUIRES, which are then built as part of the project build.

Who is online

Users browsing this forum: akashgaur0001, Bing [Bot], ChatGPT-User, Google [Bot], Qwantbot and 3 guests