Problem Statement:
How does one, using the IDF SDk, create custom components that both require the use of the SDK components and cannot be in the a projects components directory.
Personal context:
-> I am extremely new to CMake and build systems
-> I have a very basic understanding of build systems
-> I have read the build system documentation at: [url][https://docs.espressif.com/projects/esp ... elists/url]
-> I have also read up on some general CMake documentation
What I have tried:
-> I have tried using the EXTRA_COMPONENT_DIRS variable but with no success
-> I tried to use pure CMake but then during the build stage, the component/library is unable to use the idf SDK
Common issues I have come across
-> XXX is not build by this project
-> No such file or directory for both custom components and IDF components
I am aware most of the information is vague/general but I would really appreciate if someone were able to give something like a minimum example that is able to address the problem in the problem statement.
Please don't refer me back the to build system documentation because I am pretty sure I am misunderstanding/missing something and I am not sure trying to parse it for a 15th time is going to help much
How to use CMake with components in custom directory
Re: How to use CMake with components in custom directory
There are a few ways to do this...
Let's say your directory structure looks like this (it's just an arbitrary structure)...
You could do this in your myproject1/CMakeLists.ttxt
If you only wanted to include mycomponent2, you could add...
An alternative is to symlink myproject1's "components" directory to mycomponents. Then no changes to CMakeLists.txt are required.
Even another way is to symlink individual components...
If none of those work, more detail would be required.
Let's say your directory structure looks like this (it's just an arbitrary structure)...
Code: Select all
mysource
mycomponents
mycomponent1
CMakeLists.txt
..
mycomponent2
CMakeLists.txt
..
myprojects
myproject1
CMakeLists.txt
..
Code: Select all
# It's important that the "set" come before "project"
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../components")
project(myproject1)
Code: Select all
# It's important that the "set" come before "project"
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../components")
set(COMPONENTS mycomponent2 <any esp-idf components you also need>)
project(myproject1)
Code: Select all
mysource
mycomponents
mycomponent1
mycomponent2
myprojects
myproject1
components -> ../../components
Code: Select all
mysource
mycomponents
mycomponent1
mycomponent1
myprojects
myproject1
components
mycomponent2 -> ../../mycomponents/mycomponent2
Who is online
Users browsing this forum: Bing [Bot], kobylin and 94 guests