使用cmake配置vtk库,显示error in configuration process?

  • 问题:使用cmake(3.23.2)配置vtk(9.2.0)库,均为最新版本,按照教程步骤进行配置,configure时却显示error in configuration process, project files may be invalid, 如何解决?

img

  • 错误提示如下:
  1. The systems is: Windows 10.0.22000.AMD64
  1. CMake Error at CMakeLists.txt:3 (project):

Failed to run MSBuild command:

D:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe

to get the value of VCTargetsPath:

用于 .NET Framework 的 Microsoft (R) 生成引擎版本 17.2.1+52cd2da31

版权所有(C) Microsoft Corporation。保留所有权利。

生成启动时间为 2022/8/6 16:44:58。

节点 1 上的项目“D:\VTK\vtk-file\CMakeFiles\3.23.2\VCTargetsPath.vcxproj”(默认目标)。

InitializeBuildStatus:

正在对“x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild”执行 Touch 任务。

D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(157,5): error MSB6003: 指定的任务可执行文件“cmd.exe”未能运行。

System.IO.IOException: 未能创建临时文件 。临时文件文件夹已满或其路径不正确。

对路径“C:\Users???\AppData\Local\Temp\”的访问被拒绝。 ---> System.UnauthorizedAccessException: 对路径“C:\Users???\AppData\Local\Temp\”的访问被拒绝。 [D:\VTK\vtk-file\CMakeFiles\3.23.2\VCTargetsPath.vcxproj]

  • 尝试过的解决方法:
  1. 确保编译器选择与电脑下载的VS为同一版本(我的是vs17 2022);
  1. 在VS获取工具与功能中添加安装各种cmake的工具;
  1. 清除之前的错误缓存:File → Delete Cache

其实不止配置vtk库会显示,配置ITK,DCMTK都会遇到这个问题,上网查找解决办法无果后,只能来寻求帮助 无论能不能解决,先感谢大家的帮助!!

版本不匹配,换一个旧点版本

更新一下:路径拒绝访问是因为权限不够,右击cmake以管理员身份运行就可以了