Vscode-cmake-tools: Using Ninja as build system

Created on 23 Mar 2017  路  10Comments  路  Source: microsoft/vscode-cmake-tools

I'm trying to use Ninja as the build system. This is a Windows machine.

1) I'm pretty sure that I have Ninja on my path as I can run it from any command prompt.

2) If I add "cmake.generator": "Ninja" to settings.json I end up with this error:
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

3) Even if I add to to settings.json "cmake.configureArgs": [ "CMAKE_MAKE_PROGRAM=E:/ninja" ] I get the same error.

4) If I copy the command that shows on VS Code and run it on a command prompt the build configuration is executed correctly. So this leads me to think that there is a issue with CMake tools passing stuff to CMake.

bug more info needed

Most helpful comment

I've just tried this again and with the above hints I'm now able to build using Ninja.
For the record I have installed CMakeTools v0.10.2.

All 10 comments

Possibly an issue with environment variables again. Env vars have been persistently troublesome for this extension. Do you have any settings related to build environment? Are you using the environment selection feature?

Don't think I have any settings with build environment....
And... What is the environment selection?

The build environment would be the button in the bottom right of the statusbar, to the left of the line/column display. It sets the env vars for using Visual C++ without needing the special command prompt.

I can see that it's showing VC++ but I haven't set it. Actually I don't use VC++. The build is a cross compilation using gcc for arm.

If it helps, I was able to build with Ninja a few versions back.

Try un-setting it (Click the button and un-check the selected environment), and see if that has any effect on the ability to use Ninja

I have unset it and the result is the same: complains that CMAKE_MAKE_PROGRAM is not set.
Tried to add that as "cmake.configureArgs":聽[
聽聽聽聽聽聽聽聽"CMAKE_MAKE_PROGRAM=E:/ninja"
聽聽聽聽], without success. Ninja is on the system path...
What's next in order to help you debug this?

Have you deleted your build directory completely and retried the configure?

Also, the configureArgs is in the incorrect format, and rather than setting configureArgs, try setting cmake.configureSettings instead:

"cmake.configureSettings": {
  "CMAKE_MAKE_PROGRAM": "E:/ninja"
}

Have you deleted your build directory completely and retried the configure?

Yes I did

Also, the configureArgs is in the incorrect format, and rather than setting configureArgs, try setting cmake.configureSettings instead

The result is the same: it keeps complaining that CMAKE_MAKE_PROGRAM is not set....

Sorry for vanishing like I did. Is this still a problem you are seeing?

I've just tried this again and with the above hints I'm now able to build using Ninja.
For the record I have installed CMakeTools v0.10.2.

Was this page helpful?
0 / 5 - 0 ratings