I'm having some issues getting a Cmake project building on a windows container.
Calling a cmake command (specifically: cmake -G CodeBlocks - MinGW Makefiles -DCMAKE_SH=CMAKE_SH-NOTFOUND -DCMAKE_BUILD_TYPE=Release ../
) on a Hosted VS2017 build agent fails due to sh.exe being found on PATH:
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeMinGWFindMake.cmake:12 (message):
sh.exe was found in your PATH, here: C:/Program Files/Git/bin/sh.exe
A different stack overflow answer led me to believe that supplying the argument -DCMAKE_SH=CMAKE_SH-NOTFOUND
would suppress this behaviour, but I've had no luck.
Manually removing it from the PATH using:
setx /M PATH "%PATH:C:/Program Files/Git/bin/sh.exe;=%"
Doesn't seem to have an effect (or perhaps the cmake build and cmd command share the same cmd session, so the PATH change isn't propagated).
It would seem from this answer that I can persist a PATH change using Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};$newPath";
. Before I commit to this route, am I missing something? Surely CMake builds on Windows VSTS agents can't be failing for everyone.