Cannot Move Components Outside of Project Tree
Posted: Sat Nov 25, 2023 6:59 pm
I am having a problem moving components outside of a project folder. With the following directory structure...
... and the project CMakeLists.txt file containing ...
... for the almost trivial sprinkle_sensor.c of ...
... I can build the project just fine. (No errors.) But if I try to move the components folder "up" one level ...
... and then change the project CMakeLists.txt to ...
... I keep getting the error ...
I've tried all sorts of variants of the extra components directory: "..", "..\..", "..\components", but no change.
What am I doing wrong?
Code: Select all
C:\ESP\sprinkle
└─sprinkle-sensor
├─CMakeLists.txt
├─sdkconfig
├─build
├─components
│ └─sprinkle_common
│ ├─CMakeLists.txt
│ ├─component.mk
│ ├─sprinkle_common.c
│ └─include
│ └─sprinkle_common.h
└─main
├─CMakeLists.txt
└─sprinkle-sensor.c
Code: Select all
# For more information about build system see
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(sprinkle-sensor)
Code: Select all
#include <stdio.h>
#include "sprinkle_common.h"
void app_main(void) {
printf("MESSAGE_MOISTURE_SENSOR=%d\n", MESSAGE_MOISTURE_SENSOR);
}
Code: Select all
C:\ESP\sprinkle
├─components
│ └─sprinkle_common
│ ├─CMakeLists.txt
│ ├─component.mk
│ ├─sprinkle_common.c
│ └─include
│ └─sprinkle_common.h
└─sprinkle-sensor
├─CMakeLists.txt
├─sdkconfig
├─build
└─main
├─CMakeLists.txt
└─sprinkle-sensor.c
Code: Select all
# For more information about build system see
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
set(EXTRA_COMPONENTS_DIR ..)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(sprinkle-sensor)
Code: Select all
C:/ESP/sprinkle/sprinkle-sensor/main/sprinkle-sensor.c:15:10: fatal error: sprinkle_common.h: No such file or directory
15 | #include "sprinkle_common.h"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
What am I doing wrong?