Source files in sub-folder
Posted: Fri Nov 26, 2021 11:42 am
Hi, I want to use a component, but have some problems configuring it. I use ESP-IDF 4.2
I placed the files and subfolders into my project/components folder. The componenets header files are in project/components/include and the source files (.cpp) in project/components/src
I have a CMakeLists.txt in project/components
The compiler complains that it cannot find a source file (msg.cpp) so I added:
idf_component_register(
SRCS "msg.cpp"
INCLUDE_DIRS "./src" "include"
)
and variants with and without the ./
What should I do to make the building system discover project/components/src/msg.cpp ?
Do I have to add something in my CMakeLists.txt in the main folder? Or even in the top level?
Or should I add something to my main.cpp?
Thanks
Fred
I placed the files and subfolders into my project/components folder. The componenets header files are in project/components/include and the source files (.cpp) in project/components/src
I have a CMakeLists.txt in project/components
The compiler complains that it cannot find a source file (msg.cpp) so I added:
idf_component_register(
SRCS "msg.cpp"
INCLUDE_DIRS "./src" "include"
)
and variants with and without the ./
What should I do to make the building system discover project/components/src/msg.cpp ?
Do I have to add something in my CMakeLists.txt in the main folder? Or even in the top level?
Or should I add something to my main.cpp?
Thanks
Fred