vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

How to open an existing project configured by cmake-gui ?

Open xhawk18 opened this issue 2 years ago • 5 comments

Brief Issue Summary

cmake-gui is the easiest way to configure the cmake with parameters. is it possible to open the source folder by the build folder created by cmake-gui ?
the build folder may be anywhere other than "build" defaultly.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

xhawk18 avatar Jan 26 '24 06:01 xhawk18

@xhawk18 Could you explain more what you are referring to?

What do you mean by "open the source folder by the build folder"? More information could help us understand how we should triage this item. Thanks!

gcampbell-msft avatar Jan 26 '24 14:01 gcampbell-msft

cmake cmake_test.zip

The project "my_proj" has two building folders configured by cmake-gui, "build_msvc" configured under windows for msvc, and "build_wsl_gcc" configured under wsl for gcc.

"open the source folder by the build folder" may like this ---

  1. If vscode-cmake-tools opens directory "build_msvc“, then vscode navigates to "my_proj" as working directory and use "build_msvc" as "Cmake: Build Directory" for vscode-cmake-tools.

  2. If vscode-cmake-tools opens directory "build_wsl_gcc“ (in remote wsl), then vscode navigates to the "my_proj" as working directory , and use "build_wsl_gcc" as "Cmake: Build Directory" for vscode-cmake-tools.

xhawk18 avatar Jan 29 '24 01:01 xhawk18

@xhawk18 If I'm understanding you correctly, this sounds like you're asking for a feature from the cmake-gui to be able to open VS Code directly, which we don't have direct control over.

As for the VS Code CMake Tools extension itself, you can do this currently by opening VS Code in the root folder, and then pointing the cmake.buildDirectory setting to the build directory that you desire.

Could you confirm whether this works for you?

gcampbell-msft avatar Jan 29 '24 14:01 gcampbell-msft

As for the VS Code CMake Tools extension itself, you can do this currently by opening VS Code in the root folder, and then pointing the cmake.buildDirectory setting to the build directory that you desire. Could you confirm whether this works for you?

Yes, It works partially. But there're still some reasons for this feature ---

  1. vscode-cmake-tools will not exactly use the existing configurations in cmake.buildDirectory/CMakeCache.txt. It may require to re-configure compiling tools even through the CMakeCache.txt is already OK there.
  2. For multiple build directories, manually modifying cmake.buildDirectory over and over again is very inconvenient.
  3. It is easier to modify cmake parameters in cmake-gui.

xhawk18 avatar Jan 30 '24 02:01 xhawk18

@xhawk18 Thanks for the explanation. We'll add this to the backlog. We typically use the amount of up-votes an issue has as a way to gauge priority and demand from the community, we'll use this to track priority of this work item!

To the community, if you want a feature like this, please upvote the initial post!

gcampbell-msft avatar Jan 31 '24 13:01 gcampbell-msft