I'm working on an existing, large open-source project that doesn't like in-source-tree builds. So its cmake-generated .sln file is placed in the build dir that has no .git anywhere in its parent directories because that .git is in the disjoint source tree.
\build
\proj.sln
\src
\.git
How do I make Visual Studio 2019 still see these "sideways" .git files? It can see the (C etc.) sources referred in the sln, of course, but nothing relating to git works inside VS2019 in this setup, by default.
I'm guessing I could mess with 
Also, for an alternative approach if I install the cmake workload in VS and open the source folder again (instead of the sln), VS makes a big mess by immediately trying to do an in-source build (in an src\out subdir it created), and with completely wrong, auto-generated settings, like using Ninja for some reason when this project doesn't use it at all. (I suspect it did this because it could not find the out-of-source build dir, which had the right cmake cache.)
So it seems there are "miles to go" for VS to be fully useable with cmake projects like this, meaning that use out-of-source-tree build dirs. Apparently nothing really changed in the MS cmake approach in 8 years:
- It works in the context of Visual Studio’s new “Open Folder” feature rather than their established project/solution workspace. So you will have to learn the new environment.
- There are additional settings files to override CMake configuration which will be a source of duplication and confusion.
- It used the Ninja build system by default. To change it to VS projects, you have to adjust it in a settings file.
- To launch the debugger for startup executable, you have to introduce a launch file.
CodePudding user response:
For testing, try and launch Visual Studio from a CMD where you type first:
set GIT_DIR=C:\path\to\.git
cd C:\path\to\proj
.\proj.sln
(assuming the .sln extension is associated with devenv.exe)



