From d9d3d6d919d6a04fdc758e2e1d178ed668579aae Mon Sep 17 00:00:00 2001 From: James Dooley Date: Thu, 3 Jun 2021 11:05:05 -0700 Subject: [PATCH 1/3] Add advanced details about using CMake file-api --- docs/build/cmake-projects-in-visual-studio.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/build/cmake-projects-in-visual-studio.md b/docs/build/cmake-projects-in-visual-studio.md index 491d15084e3..e8b56746afd 100644 --- a/docs/build/cmake-projects-in-visual-studio.md +++ b/docs/build/cmake-projects-in-visual-studio.md @@ -63,6 +63,15 @@ When you open an existing CMake cache file (*CMakeCache.txt*), Visual Studio doe 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/). +### Advanced CMake cache troubleshooting + +As described in our 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/), Visual Studio uses CMake's [file-based API](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) for CMake versions >= 3.14 to populate the editor with information specific to your project structure. It may be necessary for your custom or preferred tools to populate a **query.json** file before generating the CMake cache. In your build output folder (the one containing **CMakeCache.txt**), create a query file named **.cmake/api/v1/query/client-MicrosoftVS/query.json** with the contents: +``` +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} +``` + +When your custom or preferred tools generate your cache, CMake will place files under .cmake/api/v1/response that Visual Studio will use to populate the editor with information specific to your project structure. + ## Building CMake projects To build a CMake project, you have these choices: From 2acb31be2a4ec945011674eddcd91c0010939027 Mon Sep 17 00:00:00 2001 From: James Dooley Date: Thu, 3 Jun 2021 11:55:33 -0700 Subject: [PATCH 2/3] Complete CMake file-api advanced text --- docs/build/cmake-projects-in-visual-studio.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/build/cmake-projects-in-visual-studio.md b/docs/build/cmake-projects-in-visual-studio.md index e8b56746afd..951152a9bd7 100644 --- a/docs/build/cmake-projects-in-visual-studio.md +++ b/docs/build/cmake-projects-in-visual-studio.md @@ -65,12 +65,12 @@ You can add an existing CMake cache to an open project. It's done the same way y ### Advanced CMake cache troubleshooting -As described in our 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/), Visual Studio uses CMake's [file-based API](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) for CMake versions >= 3.14 to populate the editor with information specific to your project structure. It may be necessary for your custom or preferred tools to populate a **query.json** file before generating the CMake cache. In your build output folder (the one containing **CMakeCache.txt**), create a query file named **.cmake/api/v1/query/client-MicrosoftVS/query.json** with the contents: +As described in our 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/), Visual Studio uses CMake's [file-based API](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) for CMake versions >= 3.14 to populate the editor with information specific to your project structure. Before generating the CMake cache it may be necessary for your custom or preferred tools create a query file named **.cmake/api/v1/query/client-MicrosoftVS/query.json** in your build output folder (the one containing **CMakeCache.txt**) with this content: ``` {"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} ``` -When your custom or preferred tools generate your cache, CMake will place files under .cmake/api/v1/response that Visual Studio will use to populate the editor with information specific to your project structure. +When your custom or preferred tools generate your cache, CMake will place files under **.cmake/api/v1/response** that Visual Studio will use to populate the editor with information specific to your project structure. ## Building CMake projects From 3e2418fc13beda6e672f63621b349ca5a13f8e49 Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Thu, 3 Jun 2021 16:36:39 -0700 Subject: [PATCH 3/3] Make the grammar checker happy Simplify for internationalization. Satisfy the grammar checker. Fix code block style. --- docs/build/cmake-projects-in-visual-studio.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/build/cmake-projects-in-visual-studio.md b/docs/build/cmake-projects-in-visual-studio.md index 951152a9bd7..c3ff52752c2 100644 --- a/docs/build/cmake-projects-in-visual-studio.md +++ b/docs/build/cmake-projects-in-visual-studio.md @@ -65,12 +65,15 @@ You can add an existing CMake cache to an open project. It's done the same way y ### Advanced CMake cache troubleshooting -As described in our 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/), Visual Studio uses CMake's [file-based API](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html) for CMake versions >= 3.14 to populate the editor with information specific to your project structure. Before generating the CMake cache it may be necessary for your custom or preferred tools create a query file named **.cmake/api/v1/query/client-MicrosoftVS/query.json** in your build output folder (the one containing **CMakeCache.txt**) with this content: -``` +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/). + +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: + +```json {"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} ``` -When your custom or preferred tools generate your cache, CMake will place files under **.cmake/api/v1/response** that Visual Studio will use to populate the editor with information specific to your project structure. +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. ## Building CMake projects