Closed amigo421 closed 7 years ago
@amigo421 You've hit both issues I've identified and fixed in #186 and corresponding PR:
You have few options:
Visual Studio 15 2017
to cmake.preferredGenerators
or to cmake.generator
to force it.@amigo421 I see you have localized UI. Do you have issues with CMake output, like #153 ?
thank you , the including this generator into prefered list solved the problem. just want to understand - previously, I was using this extension and NMake generator was in use by default, and without dev env allocating ( I supposed the extension performed a detection ), NMake is preferable due the UI issue, and yes, this is still there forme too.
also please look at the screenshot - I've selected x64 env, but cmake generating was performed for x86.
@amigo421 On Windows platforms CMake Tools try to eliminate the need for running VS code from Developer command prompt. Internally they try to discover Visual Studio installations, and collect environment variables which are initialized by vcvarsall.bat
. So then when you run 'configure' or 'build', CMake Tools will run underlying command with those discovered variables, as if it was ran from command prompt.
Then there is a trick with Environment and Generator.
When you specify 'Visual Studio 15 2017' you explicitly tell CMake to generate solution for x86 platform. If you want to run 64-bit code change it to 'Visual Studio 15 2017 Win64
and do clean configure.
CMake itself does not require Developer Command prompt for VS generators, because it gets installation path from registry and MSBuild knows exactly where to find compiler for given platform, it doesn't matter which environment you use in this case.
It makes difference for NMake generator though (and Ninja). Then CMake discovers compiler by just running cl.exe and stores its full path, so you have to select proper environment.
I don't know how it worked before, maybe it was a 'legacy mode' when CMake Tools just ran cmake
without specifying -G and msbuild was picked up, you just didn't notice. (that's similar to your initial complaint).
BTW, this discrepancy between environment and generator is also addressed in PR to #186, with more fundamental fix proposed in #190.
yes, I didn't use Visual Studio generator previously, and we had a discussion with extension author how to detect toolchain and SDK location. so it worked previously for server mode (cmake) and vs2015 toolchain without my side dev env setting up.
so I'll come back to vs2015 build tools and try , hope this will work without extra configuring otherwise, yes, I'll need to rn vscode from allocated vc dev env ...
otherwise, yes, I'll need to rn vscode from allocated vc dev env
Please set cmake.generator
to whatever you use then. This overrides generator detection and delegates work to CMake itself which runs in modified environment and should be able to find nmake (if it's what you use).
okay, thank you so please close the request then
In other hand - no any issues to generate and build the project from command line
and, for sure , vc15 is there: