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.
Build under esp-idf 4.0
Re: Build under esp-idf 4.0
Please check about specifying component requirements: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.
https://docs.espressif.com/projects/esp ... quirements
This section explains the difference between "main" component and other components with regards to requirements:
https://docs.espressif.com/projects/esp ... quirements
-
- Posts: 3
- Joined: Mon Mar 09, 2020 2:09 am
Re: Build under esp-idf 4.0
Thanks.
Is there any way to rename the 'project' component without renaming the folder name? Currently getting a
add_library cannot create target "__idf_components" because another target
with the same name already exists. The existing target is a static library
created in source directory
Is there any way to rename the 'project' component without renaming the folder name? Currently getting a
add_library cannot create target "__idf_components" because another target
with the same name already exists. The existing target is a static library
created in source directory
Who is online
Users browsing this forum: Google [Bot] and 93 guests