madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.46k stars 2.41k forks source link

cmake error about “Failed to run MSBuild command” #465

Open zengletian1491 opened 4 years ago

zengletian1491 commented 4 years ago

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.

nmoinvaz commented 4 years ago

Remove the CMakeCache.txt file and CMakeFiles directory.

Kitoali commented 2 years ago

@nmoinvaz It doesn't work at all.