It's an interesting question... Perhaps a cmake-launcher option which prefixes the CMake command? Then, when CMake executes, it runs the CMake inside of Ubuntu on Windows. This is not a use case I've ever thought of but would be excellent in terms of usability for those who want to dev for Linux on Windows.
I can confirm that there are two ways to execute commands in bash from outside of it:
bash myscript.sh which will execute myscript.sh and stop.bash -c "mycommand" which will execute the command and stop.However, you will also need path translation for the working directory when invoking cmake from WSL (Windows Subsystem for Linux, generally more Google friendly than referring to the marketing name, Ubuntu on Win...).
Indeed, would be a very nice addition. Big brother VS is actually very close to reaching the cross-platform nirvana. They solved multi-configuration by having multiple directories of CMake configurations, thus one can click-click to select an Architecture which corresponds to certain CMake configuration parametrizations.
ps.: plus, they got proper IntelliSense hooked up by extracting the required compiler flags from the CMake invocations via cmake-server mode, and generating a hidden vcxproj accordingly, which the editor can hook into.
As @MathiasMagnus says, there's a bit more than just simply prefixing the CMake commands. Still, I think the addition would be useful and is something I may want to have myself, although for different use cases. For example, I'd like to be able to build and configure over SSH, in a Docker container, or in a Vagrant VM with a shared folder. Such a thing would be useful as some kind of "CMake Launcher" that lets you invoke and work on a project in interesting and useful ways. Another big question is how this will play into cmake-server, which communicates using a named pipe (it is possible to communicate using stdin/stdout, but that has proven to be problematic and buggy compared to using a pipe, and may require some changes to CMake upstream).
Code seems to now properly support the execution of a task in a shell: https://github.com/Microsoft/vscode/issues/6579#issuecomment-288968851
How to make it work with cmake-tools?
I don't believe that will work as it currently stands, since the way the extension executes CMake is unrelated to VSCode's task execution.
hi!
Any news on this front? It would be a terrific addition!
Haven't looked at it yet, and I'm still unsure of just how to make it work. Still in the backlog.
+1 It wil be great to have that for docker
For now I use a tasks with harcoded values, but I need to change manually my settings instead of use the power of the GUI
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"showOutput": "always",
"runner": "terminal",
"command": "bash",
"args": [
"-c"
],
"isShellCommand": true,
"tasks": [
{
"taskName": "docker-cmake-configure",
"suppressTaskName": true,
"args": [
"docker exec -it ${config:custom.docker.defaultName} cmake --no-warn-unused-cli -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/arm-linux-gnueabihf-gcc-4.8 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/arm-linux-gnueabihf-g++-4.8 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -H/home/developer/project -B/home/developer/project/build"
]
},
{
"taskName": "docker-cmake-build",
"suppressTaskName": true,
"isBuildCommand": true,
"args": [
"docker exec -it ${config:custom.docker.defaultName} cmake --build /home/developer/project/build --config Debug -- -j 6"
]
}
]
}
Does the new WSL Remote extension address this issue?
yes, at least for me
@bobbrow yes it does. As far as I'm concerned, this issue can be closed.