Code: Select all
- my_project/
- CMakeLists.txt
- components/
- foo/
- CMakeLists.txt
- foo.c
Use case:
Let's say for example I want to include the protocols_examples_common component from the esp-idf examples:
The solution that works (that I'd like to avoid) is:
project/CMakeLists.txt:
Code: Select all
cmake_minimum_required(VERSION 3.16)
set(EXTRA_COMPONENT_DIRS
"$ENV{IDF_PATH}/examples/common_components/protocol_examples_common"
)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(my_project)
Code: Select all
idf_component_register(
SRCS "foo.c"
INCLUDE_DIRS "."
PRIV_REQUIRES protocol_examples_common
)
What I'd like to do however is not add the path to protocol_examples_common to EXTRA_COMPONENT_DIRS, and specify an absolute path for the component in foo/CMakeLists.txt, for example:
project/CMakeLists.txt:
Code: Select all
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(my_project)
Code: Select all
idf_component_register(
SRCS "foo.c"
INCLUDE_DIRS "."
PRIV_REQUIRES
"$ENV{IDF_PATH}/examples/common_components/protocol_examples_common"
)
Code: Select all
Failed to resolve component
'/Users/brian/.espressif/esp-idf/examples/common_components/protocol_examples_common'.