It would be nice to have Visual Studio Code<->CMake output integration without doing any additional configuration through the IDE outside of setting the build directory (for out of source builds).
I already have a way to setup a build dir with various configuration parameters (simple shell scripts), and I prefer doing it like that for established projects as it's clear to me what's happening. No need to complicate my life with kits and I don't need to relearn how to set some CMake variables.
With this minimal configuration, I would like this extension to provide me the following:
Is this possible (using existing builddirs)?
I don't see why this shouldn't work.
You just need to specify your existing build directories in cmake.buildDirectory and avoid using "CMake: Delete cached build settings an reconfigure".
"Select a kit" should be set to "Unspecified".
Yeah... I played with it a bit during the weekend and it seemed to use the existing build dir. It just wasn't clear this is possible!
Btw, is there any way to see what commands or config it's using? What are the cmake and ninja/make command arguments it's sending?
I have the same requirements. Being able to update the cmake conf from vscode is just a "nice to have". That should not interfere with the most important features of this extension (all the plumbing to launch compilations and configure intellisense, ...)
Unfortunately, I very often observe that my BuildDir is just erased silently and recreated without me calling "CMake: Delete cached build settings an reconfigure". This happens when I'm just building a target (with a build dir perfectly set up)
That is a terrible bug.
Unless the user is explicitly asking for a cmake state change (ie: changing the toolchain, the build style...), the extension should never do anything more than a
cmake .
on the build dir.
The code that does a 'rm -rf build' must be protected by an explicit UI alert anyway. I lost many hours of rebuilding because of that.
~CMake Tools has no code that will rm the build directory. The most it will remove is CMakeCache.txt and CMakeFiles, neither of which contain vital build files. If you're seeing large amounts of work being deleted for regular usage, that's quite peculiar. Could you create some reproduction steps?~
Wrong. See below.
I suspect something similiar has happened to me a couple times now. Most recently it happened when I selected a different kit. For me its its even worse because I had the CMake build directory set to ${workspaceRoot} so my entire workspace gets deleted. Luckily I commit and push to remote frequently and VS code let me "Save As" files loaded into windows so I didn't lose much. Are we sure there's nothing anywhere that deletes the build directory?
I am completely incorrect. Build directory deletion occurs when you change your kit. This is a major hiccup. I'll fix it in 1.1.3. Should be released in a few hours.
Where i can find the cmake.buildDirectory property ?
Where i can find the cmake.buildDirectory property ?
Open up settings.json and just add it as a quoted property. You should be able to get an auto-completion to verify that you spelled it correctly. If not you need to reinstall the cmake plugin.