I am a beginner with CMake. I have read some guides and tutorials, and I've managed to create and build a very simple project (in C) by writing the CMakeLists.txt file and running CMake and Make via command line. However, I mainly work with Visual Studio Code and the C language, and I'm receiving sort of mixed signals for what concerns the creation of the CMakeLists.txt file. A lot of sources (in particular here on Stack Overflow) suggest that you should manually write and maintain your CMakeLists.txt file(s). Other sources (for example, here) seem to suggest that CMake has autonomous dependency analysis capabilities. In other words, what I'm trying to find out is whether CMake (or CMake Tools extension for Visual Studio Code) has any way to autonomously generate the tree of dependencies just by parsing your source code (i.e. looking at the #include
s, etc.) and automatically write/update CMakeLists.txt, or whether you have to manually write and update the CMakeLists.txt (with commands such as add_library
, add_subdirectory
or include
), especially for very large projects with a lot of dependencies.
Asked
Active
Viewed 212 times
0

Gamma Sigma
- 9
- 2
- 4
-
Thank you for your help. I will study the link and report back as soon as possible. – Gamma Sigma May 16 '21 at 20:58
-
The idea of using cmake with visual studio os that you specify in the file how to build the project. VS cannot (and it should not) change it. – 0___________ May 16 '21 at 20:58