I’m workin with PIO, CMake + CLion since years and I really like it.
I think my CMake knowledge is not the worst but recently I struggled with the following problem:
I tried to add one of my internal libs (logger) to a pio-Project.
I placed “logger” in a subfolder called .dependencies. (/.dependencies/logger)
In CMakeListsUser I tried everything I could think of to integrate logger.
e.g.:
set(LOGGER_PACKAGE "${CMAKE_CURRENT_LIST_DIR}/.dependencies/logger")
include_directories("${LOGGER_PACKAGE}")
FILE(GLOB_RECURSE EXTRA_LIB_SOURCES_LOGGER
${LOGGER_PACKAGE}/*.*
)
set(EXTRA_LIB_SOURCES
${EXTRA_LIB_SOURCES}
${EXTRA_LIB_SOURCES_LOGGER}
)
Nothing worked. After two days back and forth I gave up and added
lib_extra_dirs =
.dependencies
to my platformio.ini - This solved my problem but!!! in my opinion, what pio generates:
FILE(GLOB_RECURSE EXTRA_LIB_SOURCES
${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/esp32azd/*.*
${CMAKE_CURRENT_LIST_DIR}/.dependencies/*.*
)
Looks like my own attempt in CMakeListsUser.txt.
Can someone explain why the approach works in CMakeListsPrivate but doesn’t work in CMakeListsUser???