VS中CMake项目生成时报错“out/build/x64-Debug“ does not appear to contain CMakeLists.txt.

我在Visual Studio 2022中导入了一个CMake项目,起初还IDE可以自动生成,因为缺少依赖,所以修改了一下CMake设置,结果就如标题报错不能构建了,错误列表显示:

CMake Error: The source directory "D:/grpc_prj/grpc/examples/cpp/helloworld/out/build/x64-Debug" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

在这里插入图片描述
切换到输出视图后可以看到IDE执行的完整命令行,发现并没有什么问题,但是CMake报错:
在这里插入图片描述
最终定位到是在CMake设置中,修改CMake变量的时候,有个变量以\字符结尾,这导致了IDE生成出来的命令行中引号被转义了!
只要把变量值结尾的\字符删掉就可以恢复正常了。万恶的Windows反人类路径!
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/yakamoz423/article/details/132879610