microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 452 forks source link

cmake.generator fails when casing is incorrect #917

Open bobbrow opened 4 years ago

bobbrow commented 4 years ago

@bobbrow Thanks for the update. I am still having issues. I now see:

[cms-client] Configuring using the "ninja" CMake generator with plattform "undefined" and toolset {}
[rollbar] Unhandled exception: Unhandled Promise rejection: Post-folder-open [cmake-server] Failed to activate protocol version: Generator "ninja" not supported. {"folder":{"uri":{"$mid":1,"fsPath":"c:\\SVNProj\\zodiac\\branches\\TRY_TML_CMake_3Oct2019","_sep":1,"external":"file:///c%3A/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019","path":"/c:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019","scheme":"file"},"name":"TRY_TML_CMake_3Oct2019","index":0}}

I guess the first message is related to #913?

The main issue seems to be:

Failed to activate protocol version: Generator "ninja" not supported. 

I can run Ninja from a cmd prompt (it is in the system path). How can I fix this problem in Code?

Originally posted by @DavidA2014 in https://github.com/microsoft/vscode-cmake-tools/issues/908#issuecomment-553798672

bobbrow commented 4 years ago

Hi David, I think I was able to reproduce your problem. This might sound silly, but can you capitalize the first letter in "Ninja"? It looks like CMake is case-sensitive...

D:\test\cmaketest2\build>cmake -G ninja ..
CMake Error: Could not create named generator ninja

I think the extension can help by checking the casing before sending the raw cmake.generator string down to CMake.

TheJCAB commented 4 years ago

Hi! I just bumped into this problem. But with a wrinkle added to it.

I had added a "cmake.generator" line to my settings file, and as stated, I wrote "ninja" without the capitalization. But... then, after correcting the line in the settings, the extension insisted in calling it "ninja". Not even deleting the line from the settings file, nor the "CMake: Delete Cache and Reconfigure" command, was able to bring it back to life. Only physically deleting the build directory did the trick for me.

Fixing that so any change to the generator name does the right thing would be great, if possible.