include error by using an external project

mmueller
Posts: 3
Joined: Fri Jun 30, 2023 6:21 pm

include error by using an external project

Postby mmueller » Wed Oct 04, 2023 12:56 am

Hello together,

currently I'm trying to include the lwm2m-protocol to the esp32-wroom.
So I'm trying among others to include an external project / library in the CMakeLists.txt of my esp32-project.
But cmake can`t find the includes imy "main.c".
I get the error messages `fatal error: lwm2m/connect.h: No such file or directory`;
Or `fatal error: ../../network_common.h: No such file or directory`.
If I get the first error message, then cmake can't find the include from my "main.c".
If I get the second error message, then cmake can't find the include from lwm2m/connect.h.

The external project that I am currently trying to include is wakaamaNode.
Here you can see the link to the external project: https://github.com/smartheim/wakaamaNode.git

I'm working on Ubuntu with with the VSCode-IDE. But the build process i do with idf.py v4.4.6 in the terminal.

Does anyone has an idea how I could include the src.cmake file or the src-directory so that cmake finds the includes?
I would be so gratefull if someone could help me. I currently do not know what I am doing wrong.

In the following I have tried to give an insight into my current project.
  1. /lwm2m-to-esp32-test02
  2.     +---components
  3.     |   +...
  4.     |
  5.     +---main
  6.     |   +---lwm2m-to-esp32-test02.c
  7.     |   +---CMakeLists.txt
  8.     |
  9.     +---wakaamaNode
  10.     |   +---src
  11.     |       +---includes
  12.     |       |   +---lwm2m
  13.     |       |   |   +--connect.h
  14.     |       |   |   + ...
  15.     |       |   +---lwm2mObjects
  16.     |       |       + ...
  17.     |       +---network
  18.     |       |   + ...
  19.     |       +---...
  20.     |       +---src.cmake
  21.     |      
  22.     +---partitions.csv
  23.     +---sdkconfig
  24.     +---CMakeLists.txt
CMakeLists.txt
  1. cmake_minimum_required(VERSION 3.16)
  2.  
  3. include($ENV{IDF_PATH}/tools/cmake/project.cmake)
  4.  
  5. include(${CMAKE_CURRENT_LIST_DIR}/wakaamaNode/src/src.cmake) #fatal error: lwm2m/connect.h: No such file or directory
  6.  
  7. #include_directories(${CMAKE_CURRENT_LIST_DIR}/wakaamaNode/src/include/) # fatal error: ../../network_common.h: No such file or directory
  8. #include_directories(${CMAKE_CURRENT_LIST_DIR}/wakaamaNode/src/network/) # fatal error: ../../network_common.h: No such file or directory
  9.  
  10. project(lwm2m-to-esp32-test02 VERSION 1.0.0)
main/CMakkeLists.txt
  1. idf_component_register(SRCS "lwm2m-to-esp32-test02.c"
  2.                     INCLUDE_DIRS ".")
lwm2m-to-esp32-test02.c
  1. #include <string.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include <errno.h>
  6.  
  7. #include <time.h>
  8.  
  9. #include "cblink.h"
  10.  
  11. #include "lwm2m/connect.h" //???
  12. #include "lwm2m/network.h"
  13. //#include "connect.h"
  14. //#include "network.h"
  15.  
  16.  
  17. void app_main(void)
  18. {
  19.     config_blink();
  20.  
  21.     while(1){
  22.         blink_on();
  23.     }
  24.  
  25. }
many thanks
mmueller

Who is online

Users browsing this forum: No registered users and 229 guests