Page 1 of 1

how to add all include directory subfolder in CMakeLists.txt file ( for a stupid newbie !)

Posted: Sun Sep 29, 2024 4:51 pm
by ManX84
Hello guys !

I am new to esp-idf and I just build a project with arduino as components with the help of VisualGDB ( esp-idf v5.1.4 ) this working
Now I create a components and add some libraries inside.

But to compile I need to add header reference from arduino core and some from esp-idf ( https://docs.espressif.com/projects/esp ... explicitly )

Actually I made this by hand one by one in my CMakeLists.txt like that :
  1. idf_component_register(
  2. SRCS "libraries.cpp" PString/PString.cpp ESP32_BleSerial/BleSerial.cpp
  3. INCLUDE_DIRS "."
  4. INCLUDE_DIRS
  5.     ../arduino/variants/alksesp32
  6.     ../arduino/libraries/ArduinoOTA
  7.     ../arduino/libraries/ArduinoOTA/src
  8.     ../arduino/libraries/AsyncUDP
  9.     ../arduino/libraries/AsyncUDP/src
  10.     ../arduino/libraries/BLE
  11.     ../arduino/libraries/BLE/src
  12.     ../arduino/libraries/BluetoothSerial
  13.     ../arduino/libraries/BluetoothSerial/src
  14.     ../arduino/libraries/DNSServer
  15.     ../arduino/libraries/DNSServer/src
  16.     ../arduino/libraries/EEPROM
  17.     ../arduino/libraries/EEPROM/src
  18.     ../arduino/libraries/ESP32
  19.     ../arduino/libraries/ESP32/src
  20.     ../arduino/libraries/ESPmDNS
  21.         ../../../../../../../../SysGCC/esp32/esp-idf/v5.1.4/components/esp_timer/src
  22.     ../../../../../../../../SysGCC/esp32/esp-idf/v5.1.4/components/esp_timer/include
  23. (...)
  24.         )
But I become crazy with this job and would like to add recursively all subfolder of ../arduino/libraries/
and all ../../../../../../../../SysGCC/esp32/esp-idf/v5.1.4/components/

..especially because I use ble and need to add all headers of esp-idf components bt (...esp-idf\v5.1.4\components\bt )

I read : https://docs.espressif.com/projects/esp ... ystem.html

but I didn't understand how to do that.. ( feel very stupid !!)

Could somebody show me ?

Thanks for help

Re: how to add all include directory subfolder in CMakeLists.txt file ( for a stupid newbie !)

Posted: Tue Oct 01, 2024 10:42 pm
by nopnop2002
You can use EXTRA_COMPONENT_DIRS like this.

https://github.com/espressif/esp-idf/bl ... eLists.txt


In your case it will look like this:

set(EXTRA_COMPONENT_DIRS "arduino/libraries")

Components in esp-idf are automatically searched.