[CMake] 'cmake.exe -G Ninja' doesn't work for VS2017 with cmake ver 3.9.1

Masaru Tsuchiyama m.tmatma at gmail.com
Sat Aug 19 22:55:41 EDT 2017


Hello

I found a bug that cmake doesn't create 'rules.ninja' while the build 
process even though generated build.ninja has a line "include rules.ninja".


Then running with -G Ninja fails with VS2017.

cmake ver 3.7.1 doesn't happen
.
cmake ver 3.9.1 happens.
cmake bb3647060cd8ddc4184687b64469d6a8554f49b3 happens.



I found this for llvm first, but it happens with the other projects.

example: HelloWorld in https://github.com/m-tmatma/cmake-sample.git

HelloWorld is a very simple cmake project.

This commands can reproduce this.
----------------------------------------------------------------
git clone https://github.com/m-tmatma/cmake-sample.git
mkdir cmake-sample\HelloWorld\Build
cd    cmake-sample\HelloWorld\Build
call "C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
cmake.exe -G Ninja ..
----------------------------------------------------------------

This is the output of cmake bb3647060cd8ddc4184687b64469d6a8554f49b3.
-------------------------------------------------------------------
-- The C compiler identification is MSVC 19.11.25506.0
-- The CXX compiler identification is MSVC 19.11.25506.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe 
-- broken
CMake Error at 
C:/gitwork/GitHub/cmake/cmake-tmatma/Modules/CMakeTestCCompiler.cmake:51 
(message):
   The C compiler "C:/Program Files (x86)/Microsoft Visual
 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe" is
   not able to compile a simple test program.

   It fails with the following output:

    Change Dir: 
C:/gitwork/test/test/cmake-sample/HelloWorld/Build/CMakeFiles/CMakeTmp



   Run Build Command:"C:/PROGRA~2/Ninja/ninja.exe" "cmTC_80f4d"

   ninja: error: build.ninja:30: loading 'rules.ninja':
   指定されたファイルが見つかりません。



   include rules.ninja

                      ^ near here





   CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
   CMakeLists.txt:10 (project)


-- Configuring incomplete, errors occurred!
See also 
"C:/gitwork/test/test/cmake-sample/HelloWorld/Build/CMakeFiles/CMakeOutput.log".
See also 
"C:/gitwork/test/test/cmake-sample/HelloWorld/Build/CMakeFiles/CMakeError.log".
-------------------------------------------------------------------

This is the output of cmake 3.7.1 for the same project.
-------------------------------------------------------------------
-- The C compiler identification is MSVC 19.11.25506.0
-- The CXX compiler identification is MSVC 19.11.25506.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe 
-- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft 
Visual 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft 
Visual 
Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe 
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: 
C:/gitwork/test/test/cmake-sample/HelloWorld/Build
-------------------------------------------------------------------


-- 
Masaru Tsuchiyama <m.tmatma at gmail.com>


More information about the CMake mailing list