zlib icon indicating copy to clipboard operation
zlib copied to clipboard

cmake error about “Failed to run MSBuild command”

Open zengletian1491 opened this issue 6 years ago • 2 comments

Compile Zlib on windows 64. After the command "cmake -G"Visual Studio 14 2015 Win64" .." is typed in, errors occur as folllows: -- Selecting Windows SDK version to target Windows 10.0.18362. CMake Error at CMakeLists.txt:4 (project): Failed to run MSBuild command:

MSBuild.exe

to get the value of VCTargetsPath:

用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.4.0+e901037fe
版权所有(C) Microsoft Corporation。保留所有权利。

生成启动时间为 2020/1/8 6:47:21。
节点 1 上的项目“C:\Users\Administrator\source\repos\zlib\zlib-1.2.8\build\CMakeFiles\3.15.19101501-MSVC_2\VCTargetsPath.vcxproj”(默认目标)。
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(382,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\Administrator\source\repos\zlib\zlib-1.2.8\build\CMakeFiles\3.15.19101501-MSVC_2\VCTargetsPath.vcxproj]
已完成生成项目“C:\Users\Administrator\source\repos\zlib\zlib-1.2.8\build\CMakeFiles\3.15.19101501-MSVC_2\VCTargetsPath.vcxproj”(默认目标)的操作 - 失败。

生成失败。

“C:\Users\Administrator\source\repos\zlib\zlib-1.2.8\build\CMakeFiles\3.15.19101501-MSVC_2\VCTargetsPath.vcxproj”(默认目标) (1) ->
(PrepareForBuild 目标) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(382,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\Administrator\source\repos\zlib\zlib-1.2.8\build\CMakeFiles\3.15.19101501-MSVC_2\VCTargetsPath.vcxproj]

    0 个警告
    1 个错误

已用时间 00:00:00.16

Exit code: 1

-- Configuring incomplete, errors occurred! See also "C:/Users/Administrator/source/repos/zlib/zlib-1.2.8/build/CMakeFiles/CMakeOutput.log".

C:\Users\Administrator\source\repos\zlib\zlib-1.2.8\build>cmake -G"Visual Studio 15 2017 Win64" .. CMake Error: Error: generator : Visual Studio 15 2017 Win64 Does not match the generator used previously: Visual Studio 14 2015 Win64 Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

zengletian1491 avatar Jan 08 '20 07:01 zengletian1491

Remove the CMakeCache.txt file and CMakeFiles directory.

nmoinvaz avatar Jan 08 '20 14:01 nmoinvaz

@nmoinvaz It doesn't work at all.

Kitoali avatar Mar 17 '22 05:03 Kitoali