Skip to content

Commit 4c8c655

Browse files
author
Colin Robertson
authored
Merge pull request #3176 from jamesdooleymsft/patch-1
Add advanced details about using CMake file-api
2 parents 236d66c + 3e2418f commit 4c8c655

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/build/cmake-projects-in-visual-studio.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ When you open an existing CMake cache file (*CMakeCache.txt*), Visual Studio doe
6363

6464
You can add an existing CMake cache to an open project. It's done the same way you'd add a new configuration. For more information, see our blog post on [opening an existing cache in Visual Studio](https://devblogs.microsoft.com/cppblog/open-existing-cmake-caches-in-visual-studio/).
6565

66+
### Advanced CMake cache troubleshooting
67+
68+
Visual Studio uses CMake's [file-based API](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) (in CMake versions 3.14 and later) to populate the editor with information specific to your project structure. For more information, see the C++ team blog post on [multi-root workspaces and file-based API](https://devblogs.microsoft.com/cppblog/visual-studio-code-cmake-tools-extension-multi-root-workspaces-and-file-based-api/).
69+
70+
Before generating the CMake cache, your custom or preferred tools may need to create a query file named **.cmake/api/v1/query/client-MicrosoftVS/query.json** in your build output folder (the folder that contains **CMakeCache.txt**). The query file should contain this content:
71+
72+
```json
73+
{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]}
74+
```
75+
76+
When your custom or preferred tools generate your cache, CMake places files under **.cmake/api/v1/response** that Visual Studio uses to populate the editor with information specific to your project structure.
77+
6678
## Building CMake projects
6779

6880
To build a CMake project, you have these choices:

0 commit comments

Comments
 (0)