【问题标题】:CMake "failed to run MSBUILD.exe" command errorCMake“无法运行MSBUILD.exe”命令错误
【发布时间】:2017-08-26 08:43:26
【问题描述】:

当我想为 opencv 3.3.0 创建 Visual Studio 15(2017) make 文件时,它给了我这个错误消息:error in configuration process, project files maybe invalid 和这些:

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:

我使用的是 Windows 10。有什么问题以及如何解决?

【问题讨论】:

    标签: visual-studio configuration cmake opencv3.0


    【解决方案1】:

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

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

    如果您确实选择了错误的编译器,请删除二进制文件夹或直接使用另一个二进制文件夹 - 然后单击配置并选择正确的编译器。

    【讨论】:

    • 我怎样才能为以前版本的 Visual Studios 安装编译器,以便我可以使用 CMake 为我没有安装的以前版本的 Visual Studios 配置/生成项目?
    【解决方案2】:

    尝试安装 Windows SDK (Windows 10 SDK) 并以 管理员权限 运行 CMake。 如果这没有帮助,请使用完整的警告和错误消息编辑您的问题,因为您已跳过最重要的部分。

    【讨论】:

      【解决方案3】:

      每当cmake 找不到 Visual Studio 组件时,这是因为cmake 使用的构建选项指定了您尚未安装的版本。因此,要么更改 cmake 选项,要么安装所需的 Visual Studio 版本(14.0=2015、15.0=2017、16.0=2019)和所需的组件(通常是 Visual C++ 组件和 Windows SDK 组件)。

      【讨论】:

        猜你喜欢
        • 2017-11-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-07-31
        • 2021-03-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多