CMake Error: The current CMakeCache.txt directory is different than the other

CMake Error: The current CMakeCache.txt directory is different than the other … CMake安装报错:CMakeCache.txt已经存在

产生原因:某天在部署linux环境时,需要安装CMake用来编译代码,众所周知,安装CMake需要以下几个步骤:

cd cmake-3.3.2   #1、进入cmake目录
./bootstrap      #2、执行bootstrap
make             #3、make
make install     #4、make安装

但是在执行make时,报了一个错误:

CMake Error: The current CMakeCache.txt directory 
当前位置CMakeCache.txt is different than the directory
另一个位置 where CMakeCache.txt was created. 
This may result in binaries being created in the wrong place. 
If you are not sure, reedit the CMakeCache.txt

原因:之前在另一个文件夹里安装了一次CMake,所以CMakeCache.txt已经存在了,在这次安装的时候被检查出来然后报错,所以如果看到这个报错的话,应该是已经安装过CMake或是某个位置有CMakeCache.txt

解决方式:根据报错的第二个路径找到CMakeCache.txt,并将其删除,最好直接删除整个CMake目录,然后再从自己将要安装的CMake目录下面重新执行make命令

rm -r cmake-3.3.2   #1、找到已经安装的cmake目录将其删除,或者找到已存在的CMakeCache.txt删除

make                #2、进入将要安装的cmake目录,重新执行make命令
make install        #3、第二步成功后继续执行make install即可

备注:
内容只针对某些情景下的需求有用,可当做参考。
The content is only useful for the needs of some situations and can be used as a reference.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值