Status: Closed (View Workflow)
Resolution: Not A Defect
Windows with MSVC
The generators for MSVC require that cl.exe is in the PATH, and the LIB and INCLUDE variables have been set up before invoking cmake. The cmakebuilder plugin cannot do that, so it cannot be used with the standalone toolchain.
It would be great if the plugin would test whether the prerequisites are given, and look for the toolchain on its own if they are not.
- is duplicated by
JENKINS-68992 cmake build does not inherit env vars from previous steps
JENKINS-69574 No way to specify Visual Studio tools for Ninja generator
Code changed in jenkins
JENKINS-29142 (cannot be fixed, but mention workaround)
One possible solution would be to change the plugin to
run a sub-shell (cmd.exe) which first runs the environment-setter-script (vcvarsall) and then runs cmake.
There would be an input field in the UI that allows users to specify the path to the environment-setter-script.
Let me know if this could be a better solution than the workaround.
Apologies for the duplicate report, but I must say I am pretty confused on what the work-around is. Looking at the documentation / HTML change from 2016 doesn't make it any clearer for me.
Is the approach recommended in Martin Kutny's blog from six years really the best way to solve this? It seems remarkable to me, given Ninja is supposed to be the recommended build tool, even on Windows these days. (Whenever I have an issue with msbuild.exe, I am told to use Ninja....)
A workaround for MSVC is described in Martin Kutny`s blog.
In short, it applies the effect of vcvarsall.bat as follows: