You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用CMake编译Assimp库失败:MSBuild执行出错求助

CMake编译Assimp库失败:MSBuild执行PostBuildEvent时出现命令识别错误

我最近在尝试用CMake编译Assimp 4.1.0库(用于OpenGL教程),但一直无法完成配置步骤。我的环境信息如下:

  • Windows 10 版本10.0.18362(64位)
  • Visual Studio 2019 Community
  • CMake 3.16.4

CMake GUI显示的配置类型为:CMAKE_CONFIGURATION_TYPES: Debug;Release;MinSizeRel;RelWithDebInfo,但执行到PROJECT指令时抛出错误,核心问题出在MSBuild执行PostBuildEvent阶段。以下是完整的错误日志:

CMake Error at CMakeLists.txt:38 (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.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 2/9/2020 12:30:21 PM.
Project "E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "x64\Debug\".
  Creating directory "x64\Debug\VCTargetsPath.tlog\".
InitializeBuildStatus:
  Creating "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
PostBuildEvent:
  echo VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\
  :VCEnd
'C:\Users\Sparkie' is not recognized as an internal or external command, operable program or batch file.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "echo VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\ [E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073:  :VCEnd" exited with code 1. [E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj]
Done Building Project "E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj" (default targets) -- FAILED.

Build FAILED.
"E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj" (default target) (1) ->
(PostBuildEvent target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "echo VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\ [E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073:  :VCEnd" exited with code 1. [E:\Softwares\assimp-4.1.0\build\CMakeFiles\3.16.4\VCTargetsPath.vcxproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.22
Exit code: 1

CMake提示配置未完成,更多错误细节可查看E:/Softwares/assimp-4.1.0/build/CMakeFiles/CMakeOutput.log。我已经花了好几周时间查找各种解决方案,但都没有效果,希望能得到大家的帮助。

内容的提问来源于stack exchange,提问作者Sparsh_Mishra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 15:17:46