我正在開發一個不喜歡 in-source-tree 構建的現有大型開源專案。因此,它的 cmake 生成的檔案被放置在其父目錄.sln中沒有任何位置的構建目錄中,因為它位于不相交的源代碼樹中。.git.git
\build
\proj.sln
\src
\.git
如何讓 Visual Studio 2019 仍能看到這些“側面”的 .git 檔案?當然,它可以看到 sln 中參考的(C 等)源,但默認情況下,在此設定中,VS2019 中沒有與 git 相關的任何內容。

我猜我可能會弄亂

此外,對于另一種方法,如果我在 VS 中安裝 cmake 作業負載并再次打開源檔案夾(而不是 sln),VS 會立即嘗試進行源內構建(在src\out它創建的子目錄中),這會造成很大的混亂,并且具有完全錯誤的自動生成設定,例如當這個專案根本不使用它時出于某種原因使用 Ninja。(我懷疑它這樣做是因為它找不到具有正確 cmake 快取的源外構建目錄。)

因此,對于像這樣的 cmake 專案,VS 完全可用,這意味著使用 out-of-source-tree 構建目錄似乎還有“英里”。顯然,MS cmake 方法在 8 年內沒有真正改變:
- 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.
uj5u.com熱心網友回復:
要進行測驗,請嘗試從您首先鍵入的 CMD 啟動 Visual Studio:
set GIT_DIR=C:\path\to\.git
cd C:\path\to\proj
.\proj.sln
(假設.sln擴展名與 相關聯devenv.exe)
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/419406.html
標籤:
