Issue with the Ninja generator in CMakePresets.json with Visual Studio 2022 and v140 toolset

Tanguy 0 Reputation points
2023-05-29T08:31:35.4933333+00:00

Hello,

When using the Ninja generator in CMakePresets.json under Visual Studio 2022 (17.6.2 and priors) , with toolset = "v140,host=x64" (external) and architecture = "x86" (external), cmake is unable to find the compiler, and some dlls are not found (like mspdbcore.dll). However it works with the x64 architecture.

I installed the Visual 2015 compiler through the menu Get Tools and Features from Visual 2022 (looking for v140).

I open the solution by right clicking on the code repo in windows explorer, then click "open with visual studio".

I'm a bit afraid to have to call vcvars before, but it's not really what I'd expect from visual studio, as it's not forbidden to define configurations for multiple compilers in the same CMakePresets.json (and that's the need of my team).

As the external strategy is advised when using Ninja, I believe that the issue is somewhere in the Visual Studio IDE that might be failing to call the expected vcvars script from Visual 2015.

A fix for that would.be welcome :)

Thank you !

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2023-05-30T03:22:54.8966667+00:00

    Hi @Tanguy

    Welcome to Microsoft Q&A! 

    Please refer to the document to configure your CMake Presets. 

    If it doesn’t work, you can report it in dedicated CMake forum. Thanks for your understanding!

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.