[生成NMake Makefile时出现cmake错误

问题描述 投票:1回答:1

我的系统是Windows,已安装Visual Studio 2010和cmake-3.4.1。我想使用跟随命令来生成NMake Makefile:

SET PATH=D:\Program Files\CMake\bin;D:\Program Files\Microsoft Visual Studio 10.0\VC\bin;D:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
SET LIB=D:\Program Files\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
cmake -G"NMake Makefiles" ..

然后,出现错误:

-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Check for working C compiler: D:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: D:/Program Files/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken
CMake Error at D:/Program Files/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "D:/Program Files/Microsoft Visual Studio
  10.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: F:/codeing/ng/code/eclipse/CMakeFiles/CMakeTmp



  Run Build Command:"nmake" "/NOLOGO" "cmTC_380fe\fast"

        "D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" -f
  CMakeFiles\cmTC_380fe.dir\build.make /nologo -L
  CMakeFiles\cmTC_380fe.dir\build

  Building C object CMakeFiles/cmTC_380fe.dir/testCCompiler.c.obj

        D:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe
  @C:\Users\ADMINI~1\AppData\Local\Temp\nm7733.tmp

  testCCompiler.c

  Linking C executable cmTC_380fe.exe

        "D:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
  --intdir=CMakeFiles\cmTC_380fe.dir --manifests --
  D:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /nologo
  @CMakeFiles\cmTC_380fe.dir\objects1.rsp
  @C:\Users\ADMINI~1\AppData\Local\Temp\nm787C.tmp

  鍙傛暟閿欒銆俁C Pass 1 failed to run.

  NMAKE : fatal error U1077: “"D:\Program Files\CMake\bin\cmake.exe"”:
  返回代码“0xffffffff”

  Stop.

  NMAKE : fatal error U1077: “"D:\Program Files\Microsoft Visual Studio
  10.0\VC\bin\nmake.exe"”: 返回代码“0x2”

  Stop.





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


-- Configuring incomplete, errors occurred!
See also "F:/codeing/ng/code/eclipse/CMakeFiles/CMakeOutput.log".
See also "F:/codeing/ng/code/eclipse/CMakeFiles/CMakeError.log".

我检查文件CMakeError.log,内容如下:

Determining if the C compiler works failed with the following output:
Change Dir: F:/codeing/ng/code/eclipse/CMakeFiles/CMakeTmp

Run Build Command:"nmake" "/NOLOGO" "cmTC_380fe\fast"
    "D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" -f CMakeFiles\cmTC_380fe.dir\build.make /nologo -L                  CMakeFiles\cmTC_380fe.dir\build

Building C object CMakeFiles/cmTC_380fe.dir/testCCompiler.c.obj

    D:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe  @C:\Users\ADMINI~1\AppData\Local\Temp\nm7733.tmp

testCCompiler.c

Linking C executable cmTC_380fe.exe

    "D:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_380fe.dir --manifests  -- D:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /nologo @CMakeFiles\cmTC_380fe.dir\objects1.rsp @C:\Users\ADMINI~1\AppData\Local\Temp\nm787C.tmp

鍙傛暟閿欒銆俁C Pass 1 failed to run.

NMAKE : fatal error U1077: “"D:\Program Files\CMake\bin\cmake.exe"”: 返回代码“0xffffffff”

Stop.

NMAKE : fatal error U1077: “"D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"”: 返回代码“0x2”

Stop.

实际上,我发现已经生成了CMakeCCompilerId.exe和CMakeCXXCompilerId.exe(在.. \ CMakeFiles \ 3.4.1 \ CompilerIdC \和.. \ CMakeFiles \ 3.4.1 \ CompilerIdCXX \目录中),为什么cmake仍然失败?如何解决这个问题?

visual-studio-2010 cmake nmake
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.