question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ninja generator is used instead of Visual Studio 16 2019

See original GitHub issue

Brief Issue Summary

When I select the kit “Visual Studio Community 2019 Release - amd64”, vscode-cmake-tools is passing ‘-G Ninja’ to cmake instead of ‘-G “Visual Studio 16 2019” -A x64’.

My cmake-tools-kit.json file contains the entry:

  {
    "name": "Visual Studio Community 2019 Release - amd64",
    "visualStudio": "da769ae6",
    "visualStudioArchitecture": "amd64",
    "preferredGenerator": {
      "name": "Visual Studio 16 2019",
      "platform": "x64"
    }
  },

What is strange is that I get the correct behavior when I select “Visual Studio Community 2017 Release - amd64” (in that case I can see ‘-G “Visual Studio 15 2017” -A x64’ passed to cmake, which is correct). For this one the entry is:

  {
    "name": "Visual Studio Community 2017 Release - amd64",
    "visualStudio": "05246a08",
    "visualStudioArchitecture": "amd64",
    "preferredGenerator": {
      "name": "Visual Studio 15 2017",
      "platform": "x64"
    }
  },

that seems pretty similar to the one for VS 2019. So I don’t know how vscode-cmake-tools interprets the file cmake-tools-kits.json, but it seems that it does treat both cases in the same way.

Expected:

  1. “CMake: Select a Kit” command
  2. Choose “Visual Studio Community 2019 Release - amd64”
  3. “CMake: Configure” command
  4. cmake should be called with option ‘-G “Visual Studio 16 2019” -A x64’

Apparent Behavior:

  1. “CMake: Select a Kit” command
  2. Choose “Visual Studio Community 2019 Release - amd64”
  3. “CMake: Configure” command
  4. cmake is called with option ‘-G Ninja’

CMake Tools Log

[main] Configuring folder: gltf-viewer-tutorial-git 
[proc] Executing command: C:\Users\laure\scoop\shims\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hd:/projects/opengl_tds/gltf-viewer/gltf-viewer-tutorial-git -Bd:/projects/opengl_tds/gltf-viewer/build-gltf-viewer-tutorial -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is MSVC 19.23.28106.4
[cmake] -- The CXX compiler identification is MSVC 19.23.28106.4
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- works
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
[cmake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe -- works
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Looking for pthread.h
[cmake] -- Looking for pthread.h - not found
[cmake] -- Found Threads: TRUE  
[cmake] -- Using Win32 for window creation
[cmake] -- Found OpenGL: opengl32   
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: D:/projects/opengl_tds/gltf-viewer/build-gltf-viewer-tutorial

Platform and Versions

  • Operating System: Windows 10 Build 18362
  • CMake Version: 3.16.4
  • VSCode Version: 1.42.1
  • CMake Tools Extension Version: 1.3.0
  • Compiler/Toolchain: Visual C++ 2019

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
andreeiscommented, May 15, 2020

CMake Tools 1.4.0 Beta is available on GitHub. https://github.com/microsoft/vscode-cmake-tools/releases/tag/1.4.0-beta

Please try it out and let us know if you encounter any issues.

1reaction
andreeiscommented, May 20, 2020

This fix is available in CMake Tools #1.4.0 which has been released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Choosing the right generator: ninja vs visual studio 2019
CMake generates build system files for Visual Studio 16, not for NINJA, as I exected. So, looks like -G ninja is simply ignored…...
Read more >
CMake integration with Ninja generator fails to find the right ...
When I switch the generator using the CMakeSettings.json to Visual Studio 15 2017 everything works as expected but Ninja doesn't.
Read more >
Visual Studio wants Ninja Generator even though I don't have ...
Somehow cmake -G Ninja . was getting run in the background even when I generated the build files from a non-VS command prompt....
Read more >
Visual Studio 16 2019 — CMake 3.25.1 Documentation
New in version 3.14. Generates Visual Studio 16 (VS 2019) project files. ... The CMAKE_GENERATOR_INSTANCE variable may be used to select one.
Read more >
Customize CMake build settings in Visual Studio
Visual Studio currently supports the following CMake generators: "Ninja"; "Unix Makefiles"; "Visual Studio 16 2019"; "Visual Studio 16 2019 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found