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

ManX84
Posts: 1
Joined: Sun Sep 29, 2024 4:25 pm

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

Postby ManX84 » Sun Sep 29, 2024 4:51 pm

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

nopnop2002
Posts: 112
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

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

Postby nopnop2002 » Tue Oct 01, 2024 10:42 pm

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.

Who is online

Users browsing this forum: Gaston1980 and 180 guests