Home > Net >  How to build a CMake project with MSVC 2015?
How to build a CMake project with MSVC 2015?

Time:11-24

I try to build a CMake (v3.14) project with MSVC 2015. I use the CMake GUI to generate the makefile but when I hit the "Configure" button, I get the following error:

The C compiler identification is MSVC 19.0.24210.0
The CXX compiler identification is MSVC 19.0.24210.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Projets/geolibextern/build_msvc/CMakeFiles/CMakeTmp
    
    Run Build Command(s):nmake /nologo cmTC_fa317\fast 
        "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\cmTC_fa317.dir\build.make /nologo -L                  CMakeFiles\cmTC_fa317.dir\build

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

        C:\PROGRA~2\MICROS~2.0\VC\bin\amd64\cl.exe @C:\Users\egrace\AppData\Local\Temp\nm88C7.tmp

    testCCompiler.c

    Linking C executable cmTC_fa317.exe

        "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_fa317.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~2\MICROS~2.0\VC\bin\amd64\link.exe /nologo @CMakeFiles\cmTC_fa317.dir\objects1.rsp @C:\Users\egrace\AppData\Local\Temp\nm8993.tmp

    RC Pass 1: command "rc /foCMakeFiles\cmTC_fa317.dir/manifest.res CMakeFiles\cmTC_fa317.dir/manifest.rc" failed (exit code 0) with the following output:
    Le fichier sp‚cifi‚ est introuvableNMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'

    Stop.

    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'

    Stop.

I also tried (unsuccessfully) to reinstall the Visual C build tools or to use a more recent version of CMake.

CodePudding user response:

Indeed, CMake couldn't find the program mt.exe because the Windows SDK folder wasn't in the PATH variable. To solve this problem, I need to execute this command with these arguments:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 8.1
  • Related