Search code examples
esp32esp-idf

esp-idf : I can't include mdebtls directory in a component


On esp32, using esp-idf, I built a module called webSocket.c/.h . it includes

#include "esp32/sha.h"

As this module is generic, I want to put it in a component. I moved it to "components/webSocket" directory and added a CMakeLists.txt file like this:

FILE(GLOB cFiles *.c)

set(
    COMPONENT_SRCS 
    ${cFiles}
)

set(COMPONENT_ADD_INCLUDEDIRS 
       "."
  )
  
register_component()

From this point, the module does not compile anymore because the above included file is unreachable.

This module is part of esp-idf framework, or more accurately, part of mbedtls lib which is embedded in esp-idf framework.

I tried all these path without success:

mbedtls/port/include/esp32/sha.h
port/include/esp32/sha.h
include/esp32/sha.h
esp32/sha.h
sha.h

None is successfull, how should I do?


Solution

  • Added

    set(COMPONENT_REQUIRES mbedtls)
    

    to CMakeLists did the trick.