How to add all include folders and source files of project in CMakeList.txt
Posted: Fri Mar 19, 2021 3:23 pm
Hello,
I am using ESP-IDV v4.2 on Eclipse along with ESP-IDF plugin and I am able to compile ESP-IDF example codes and testing the same on ESP32-Wrover-B.
I want to include all source files i.e. "*.cpp" and include files "*.h" of complete project in CMakeList.txt.
I have around hundred of .cpp and .h files and it is not possible to make each and every file entry like this
//------------------ CMakeLists.txt
set( srcs "app_main.cpp"
"Main.cpp"
"test.cpp" )
set (include_dirs "Test_Code"
"Config")
df_component_register( SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
)
My project directory hierarchy goes like this
MyProject ( Folder )
-- Maths ( folder )
--- Sum (Folder)
----- Sum.cpp
----- Sum.h
--- Sub (Folder)
----- Sub.cpp
----- Sub.h
-- Science (Folder)
-- Database (Folder)
---- Database.cpp
---- Database.h
-- Algorithm
---- Algorithm.cpp
---- Algorithm.h
-- app_main.cpp ( contain app_main() function )
CMakelist.txt ( Includes path to all .cpp and .h include directories )
component.mk ( contain just COMPONENT_ADD_INCLUDEDIRS := . )
I am using only once CMakelist.txt that is compiling all files.
Please let me know if anyone has tried any command to add all source files and header files of project that is more easier than adding them manually.
Thanks in advance.
I am using ESP-IDV v4.2 on Eclipse along with ESP-IDF plugin and I am able to compile ESP-IDF example codes and testing the same on ESP32-Wrover-B.
I want to include all source files i.e. "*.cpp" and include files "*.h" of complete project in CMakeList.txt.
I have around hundred of .cpp and .h files and it is not possible to make each and every file entry like this
//------------------ CMakeLists.txt
set( srcs "app_main.cpp"
"Main.cpp"
"test.cpp" )
set (include_dirs "Test_Code"
"Config")
df_component_register( SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
)
My project directory hierarchy goes like this
MyProject ( Folder )
-- Maths ( folder )
--- Sum (Folder)
----- Sum.cpp
----- Sum.h
--- Sub (Folder)
----- Sub.cpp
----- Sub.h
-- Science (Folder)
-- Database (Folder)
---- Database.cpp
---- Database.h
-- Algorithm
---- Algorithm.cpp
---- Algorithm.h
-- app_main.cpp ( contain app_main() function )
CMakelist.txt ( Includes path to all .cpp and .h include directories )
component.mk ( contain just COMPONENT_ADD_INCLUDEDIRS := . )
I am using only once CMakelist.txt that is compiling all files.
Please let me know if anyone has tried any command to add all source files and header files of project that is more easier than adding them manually.
Thanks in advance.