[Solved] EXTRA_COMPONENT_DIRS not working for me
Posted: Sat May 30, 2020 12:25 pm
I have arranged my builds such that I have a common CMakeLists.txt in one directory and below it, in sub-directories, I have builds that make use of this common CMakeLists.txt, e.g. "thing1", which will in turn have the usual "main" sub-directory inside them. The common CMakeLists.txt pulls in generic source code, "thing1" will bring in its own main.c and anything else it needs.
In the CMakeLists.txt file in each of the "thingx" directories I set EXTRA_COMPONENT_DIRS to ".." in the hope of referring to the common CMakeLists.txt in the directory above. However, this doesn't work, the contents of my common CMakeLists.txt never make it into the build, it is never listed in the list of components. What might I be doing wrong?
This is the CMakeLists.txt in the "thingx" directory:
...and this is the kind of thing I have in the common CMakeLists.txt in the directory above:
...and, for completeness, this is the CMakeLists.txt from the "main" directory of "thingx":
This is with ESP-IDF version 4.1 and I am in the "thing1" directory when I execute "idf.py flash".
Thanks in advance for your help.
In the CMakeLists.txt file in each of the "thingx" directories I set EXTRA_COMPONENT_DIRS to ".." in the hope of referring to the common CMakeLists.txt in the directory above. However, this doesn't work, the contents of my common CMakeLists.txt never make it into the build, it is never listed in the list of components. What might I be doing wrong?
This is the CMakeLists.txt in the "thingx" directory:
Code: Select all
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS "..")
# Empty the component list, main will bring in just what it needs
set(COMPONENTS "")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(example)
Code: Select all
set(COMPONENT_ADD_INCLUDEDIRS "../../api" "../../cfg")
set(COMPONENT_SRCS "../../src/blah.c")
register_component()
Code: Select all
set(COMPONENT_SRCS "main.c")
set(COMPONENT_REQUIRES "esp32" "esptool_py")
register_component()
Thanks in advance for your help.