esp-aws-iot icon indicating copy to clipboard operation
esp-aws-iot copied to clipboard

libraries/common/posix_compat missing path to esp_timer (CA-229)

Open davidallenmann opened this issue 3 years ago • 1 comments

/libraries/common/posix_compat/CMakeLists.txt should add path for esp_timer or get build error missing esp_timer.h Tested with mqtt_demo_mutual_auth

idf_component_register(
    SRCS
        "clock_esp.c"
        "semaphore.c"
    INCLUDE_DIRS
        "."
        "$ENV{IDF_PATH}/components/esp_timer/include"
    REQUIRES
)

davidallenmann avatar Jul 13 '22 17:07 davidallenmann

I just went through all this....and its a pain the first time around.

First at the project level include extra components like this:

set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/components/esp-aws-iot/libraries/common/posix_compat" )

Second at the project component level (main component or another component) -- add REQUIRES posix_compat to your idf_component_register statement

Third -- #include "" in the place that you need it (either source or header file).

It can be more complex than this -- you can PRIV_REQUIRE it as well (learn how private vs non-private can help you reduce the scope of the included components and reduce your exposure to possible undefined reference troubles)

It's an unpleasant experience when you're just getting up to speed with CMake, but I'm starting to like it more now that it seems to be working for me.

SolidStateLEDLighting avatar Oct 16 '22 20:10 SolidStateLEDLighting