CMake does not find Visual C++ compiler

前端 未结 27 2398
小鲜肉
小鲜肉 2020-11-29 18:51

After installing Visual Studio 2015 and running CMake on a previous project, CMake errors stating that it could not find the C compiler.

The C compiler ident         


        
27条回答
  •  臣服心动
    2020-11-29 19:19

    Menu → Visual Studio 2015 → MSBuild Command Prompt for Visual Studio 2015. Then CMake can find cl.exe.

    set PATH="c:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\";%PATH%
    

    Change the upper path to where your Windows SDK is installed.

    CMake can find rc.exe.

    cd to the path of CMakeLists.txt and do:

    md .build
    cd .build
    cmake .. -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release
    cmake --build .
    

    The param after -G should be fetched by CMake. Use --help; you may or may not have the generator.

提交回复
热议问题