Closed tengai650 closed 2 weeks ago
@tengai650 I think the problem is because you set the hidden attribute in the config to true, when I set this attribute to false, I don't have the problem you mentioned.
@gcampbell-msft I am reproducing the problem stated by the user with a simple project, I think the user's problem is caused by setting the hidden attribute to true, here are my steps to reproduce it:
ENV: VS Code: 1.90.0 CMake tools: 1.18.42 C/C++:1.20.5
cmake_minimum_required(VERSION 3.5)
project(test)
add_executable(test main.cpp)
#include"iostream"
int main() { std::cout << "Hello world\n" << std::endl; }
4. Add CMakePresets.json file with the following code:
{ "version": 6, "configurePresets": [ { "name": "debug_x64", "hidden":true, "generator": "Visual Studio 17 2022", "binaryDir": "${workspaceFolder}/build", "description": "Default build.", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "CMAKE_EXPORT_COMPILE_COMMANDS": "YES", "BOOST_ROOT": "G:/dev/boost/boost_1_85_0" } }, { "name": "release_x64", "hidden": true, "generator": "Visual Studio 17 2022", "binaryDir": "${workspaceFolder}/build", "description": "Release build.", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "YES", "BOOST_ROOT": "G:/dev/boost/boost_1_85_0" } } ], "buildPresets": [ { "name": "Release", "description": "", "displayName": "", "configurePreset": "release_x64" }, { "name": "Debug", "description": "", "displayName": "", "configurePreset": "debug_x64" } ] }
5. Run the command:"**CMake:configure**"
The result of setting the hidden attribute value to true:
![image](https://github.com/microsoft/vscode-cmake-tools/assets/160998958/8b243e1c-31b4-419a-ae30-604dfe7290b8)
The result of setting the hidden attribute value to false:
![image](https://github.com/microsoft/vscode-cmake-tools/assets/160998958/ddbd6efc-5c9a-4a7b-a524-c1539b665503)
@tengai650 @v-frankwang While this is not exactly matching the behavior of cmake.exe, you should have at least one configure preset visible.
The cmake.exe does allow you to list the build presets even if they use hidden configure Presets, you are not able to build with the command-line with the build presets that use a hidden configure preset. Therefore, the current behavior makes sense.
Closing for now, since you should be using non-hidden configure presets. Thanks! Let me know if there are any other questions.
Brief Issue Summary
VisualCode
Here is my CMakePresets.json file:
CMake Tools Diagnostics
Debug Log
No response
Additional Information
Visua Code Version: 1.90.1 (user setup) Commit: 611f9bfce64f25108829dd295f54a6894e87339d Date: 2024-06-11T21:01:24.262Z Electron: 29.4.0 ElectronBuildId: 9593362 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22631