CMake“无法运行MSBUILD.exe”命令错误 [英] CMake "failed to run MSBUILD.exe" command error

查看:862
本文介绍了CMake“无法运行MSBUILD.exe”命令错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想为opencv 3.3.0创建Visual Studio 15(2017)制作文件时,它给我以下错误消息:配置过程中出错,项目文件可能无效以及以下这些:

When I want to create visual studio 15(2017) make files for opencv 3.3.0, it gives me this error message: error in configuration process, project files maybe invalid and these:

CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
  The OLD behavior for policy CMP0020 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:85 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:94 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Error at CMakeLists.txt:127 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

我使用Windows10。问题是什么以及如何解决?

I use windows 10. What is the problem and how can I fix it?

推荐答案

在CMake-gui中:选择源&二进制文件夹,然后单击配置,它将询问您要使用哪个版本的编译器。确保选择了正确的

In CMake-gui: After you selected the source & binary folder and click "configure" it will ask you which version of the compiler to use. Make sure that you select the correct one

例如,如果您安装了 Visual Studio 2015并选择了 Visual Studio 2017,则会遇到无法运行MSBuild命令:错误。

For example, if you have "Visual Studio 2015" installed and you select "Visual Studio 2017", you will run into the "Failed to run MSBuild command:" error.

如果确实选择了错误的选项,则删除二进制文件文件夹或直接使用其他二进制文件文件夹-然后单击配置。然后选择正确的编译器。

If you did select the wrong one, either delete the binaries-folder or simply use another binaries-folder - and then click configure and select the correct compiler.

这篇关于CMake“无法运行MSBUILD.exe”命令错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆