Let's say I'm part of a team of developers working on an application. The application "lives" on GitHub and we have decided to use CMake because people use different operating systems and editors.
Here is the project structure for the application:
MyProject
├── CMakeLists.txt
├── include
│ └── hello.h
├── src
│ └── hello.cpp
└── build
I'm on Windows and I want to use Visual Studio to work on the application. So I get the codebase from GitHub and run the following commands:
cd build
cmake -G "Visual Studio 17 2022" ..
Then CMake generates a solution (.sln file) for my project which I can open in Visual Studio. Inside Visual Studio, I can build and run my project just fine, but how do I continue work from here?
The solution explorer doesn't show the actual project structure at all - it just uses filters for "Header Files" and "Source Files".
If I add a new header file inside Visual Studio, it is not added to the include folder (where it belongs), it goes inside the build folder.
Additionally, CMakeLists.txt should also be updated when a new file is added. It seems error prone to do so manually every time a new file is added.
Clearly this is not the way to go.
What is the intended workflow for CMake on Windows using Visual Studio?
Is there a good way to work with the generated solution such that files go where they are supposed to and CMakeLists.txt is updated accordingly? How do people generally work on a CMake project on Windows?