CMake configuration fails with Ninja under Windows
Tested against the CMake project's own source code, with cmake built from source via NMake
CMake can successfully create a makefile when launched within a properly configured terminal session under Windows 10 with Visual Studio 15.9 Preview 3 installed, and when the following is executed within CMake's own source directory, all is well:
mkdir winbuild; cd winbuild
cmake .. -G "NMake Makefiles"
But when using the "Ninja" generator instead, something is off and commands fail immediately
D:\rand\cmake\winbuild>which ninja.exe
C:\Users\Mahmoud\Bin\ninja.exe
D:\rand\cmake\winbuild>..\jom-build\bin\cmake.exe -G Ninja ..
-- The C compiler identification is MSVC 19.16.26926.0
-- The CXX compiler identification is MSVC 19.16.26926.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.16.26926/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.16.26926/bin/Hostx64/x64/cl.exe -- broken
CMake Error at Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/Preview/Community/VC/Tools/MSVC/14.16.26926/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/rand/cmake/winbuild/CMakeFiles/CMakeTmp
Run Build Command:"C:/Users/Mahmoud/bin/ninja.exe" "cmTC_8f554"
[1/2] Building C object CMakeFiles\cmTC_8f554.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_8f554.exe
FAILED: cmTC_8f554.exe
cmd.exe /C "cd . && D:\rand\cmake\jom-build\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_8f554.dir --manifests -- C:\PROGRA~2\MIB055~1\Preview\COMMUN~1\VC\Tools\MSVC\1416~1.269\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_8f554.dir\testCCompiler.c.obj /out:cmTC_8f554.exe /implib:cmTC_8f554.lib /pdb:cmTC_8f554.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
-- Configuring incomplete, errors occurred!
See also "D:/rand/cmake/winbuild/CMakeFiles/CMakeOutput.log".
See also "D:/rand/cmake/winbuild/CMakeFiles/CMakeError.log".
Just after this error is shown, a new console window is spawned and closes immediately. I think at some point in the process a command is being run asynchronously in a new cmd.exe instance rather than synchronously and then of course it fails to find the results.
Ninja was first downloaded from the binaries available on their website, and then as a second attempt was rebuilt from source without changing the results.
Executing the command that supposedly fails reveals absolutely nothing:
> cd . && "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_3f636.dir --manifests -- C:\PROGRA~2\MIB055~1\Preview\COMMUN~1\VC\Tools\MSVC\1416~1.269\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_3f636.dir\testCCompiler.c.obj /out:cmTC_3f636.exe /implib:cmTC_3f636.lib /pdb:cmTC_3f636.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
>