【问题标题】:CMake can't get the value of VCTargetsPath when generating for UWP为 UWP 生成时 CMake 无法获取 VCTargetsPath 的值
【发布时间】:2020-09-02 16:04:17
【问题描述】:

我正在尝试使用 CMake 构建通用 Windows 应用,但出现以下构建错误(安装了最新的 Visual Studio 2019 和 Windows 10 SDK):

› cmake -B. -H<my source dir> -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.
CMake Error at CMakeLists.txt:3 (project):
  Failed to run MSBuild command:

    C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe

  to get the value of VCTargetsPath:

    Microsoft (R) Build Engine version 16.5.1+4616136f8 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

    Build started 5/16/2020 9:52:00 PM.
    Project "C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" on node 1 (default targets).
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(777,5): error : The OutputPath property is not set for project 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='x64'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
    Done Building Project "C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default target) (1) ->
    (_CheckForInvalidConfigurationAndPlatform target) ->
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(777,5): error : The OutputPath property is not set for project 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='x64'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]

        0 Warning(s)
        1 Error(s)

    Time Elapsed 00:00:00.07


  Exit code: 1



-- Configuring incomplete, errors occurred!

这是什么意思?我还尝试为 CMAKE_SYSTEM_VERSION 指定确切的 Windows SDK 版本,但没有成功。

【问题讨论】:

  • 请检查vcxproj文件是否包含&lt;PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"&gt; &lt;OutputPath&gt;xxxxx\&lt;/OutputPath&gt; &lt;/PropertyGroup&gt;
  • 我也有同样的问题

标签: c++ cmake uwp windows-store-apps


【解决方案1】:

我解决了这个问题。我做了很多事情,因此我不知道哪一个完全解决了这个问题。但请尝试以下方法。

VisualStudio Installer 应用,点击Modify 并安装C++ Universal Windows Platform support for v142 build tools (ARM64) 单个组件。

【讨论】:

  • 谢谢!虽然安装该软件包并没有改变任何东西,但我通过安装整个 UWP 开发工作负载来修复它。
  • 我想提一下,在面对 UWP 时它是一团糟。让我指出我提出的另一个问题。如果你面对它SO question link
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-05
  • 2017-12-10
  • 2014-07-01
  • 2021-02-24
相关资源
最近更新 更多