CMake Error: The source “xxx“ does not match the source “yyy“ used to generate cache. Re-run cmake


场景复现

今天使用CMake再次编译fmt源码时,cmake抛出一个错误。告诉我找不到一个路径,但我这个电脑本就没有这个路径。仔细一看这个路径是我在另一个电脑编译的路径。我就猜测可能是缓冲文件在捣乱。

CMake Error: The source “E:/C++Project/fmt/CMakeLists.txt” does not match the source “F:/C++Project/fmt/CMakeLists.txt” used to generate cache. Re-run cmake with a different source directory.

cmake界面:
在这里插入图片描述

解决方案

找到我们的编译路径

删掉这个文件,这个文件保留了上次的编译的信息。
在这里插入图片描述

重新使用CMake编译

重新使用cmake编译,就不会抛出这种错误了。可以正常编译咯。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_45254369/article/details/129783896
今日推荐