Build under esp-idf 4.0
Posted: Mon Mar 09, 2020 2:33 am
I inherited code written for 3.2 that I am trying to build in 4.0. It appears that I don't have something set up properly and I don't know what that is. My code structure is:
src
|----main
|----components
src:
CMakeList.txt from src (top-level) has:
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS $(PROJECT_PATH)/components $(IDF_PATH)/components)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test_proj)
main:
main folder has a blank/default components.mk. CMakeList.txt from main has:
set(COMPONENT_SRCS "main_img.cpp")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
components:
components.mk in components contains:
#include($ENV{IDF_PATH}/cmake/component.cmake)
#include($ENV{IDF_PATH}/tools/cmake/project.cmake)
CMakeList.txt from components contains:
set(COMPONENT_SRCS "file1.cpp" "file2.cpp"
set(EXTRA_COMPONENT_DIRS $(IDF_PATH)/components)
register_component()
However, when I build, I get things like:
In file included from ../components/file1.cpp:5:
../components/file1.h:: fatal error: wifi_scan.h: No such file or directory
#include <wifi_scan.h>
Looks like CMAKE doesn't know where to look for header files from IDF_PATH when building the project's components. It does, however, find header files from IDF_PATH when they are included from code in main folder.
src
|----main
|----components
src:
CMakeList.txt from src (top-level) has:
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS $(PROJECT_PATH)/components $(IDF_PATH)/components)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test_proj)
main:
main folder has a blank/default components.mk. CMakeList.txt from main has:
set(COMPONENT_SRCS "main_img.cpp")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
components:
components.mk in components contains:
#include($ENV{IDF_PATH}/cmake/component.cmake)
#include($ENV{IDF_PATH}/tools/cmake/project.cmake)
CMakeList.txt from components contains:
set(COMPONENT_SRCS "file1.cpp" "file2.cpp"
set(EXTRA_COMPONENT_DIRS $(IDF_PATH)/components)
register_component()
However, when I build, I get things like:
In file included from ../components/file1.cpp:5:
../components/file1.h:: fatal error: wifi_scan.h: No such file or directory
#include <wifi_scan.h>
Looks like CMAKE doesn't know where to look for header files from IDF_PATH when building the project's components. It does, however, find header files from IDF_PATH when they are included from code in main folder.