cmake 如何清除/删除缓存变量

pexxcrt2  于 2023-04-30  发布在  其他
关注(0)|答案(1)|浏览(168)

想让find_path做我想做的事。

find_path(temmp include/help.h)
message("temmp= ${temmp}")

help.h找到了输出为temmp= /usr/local/toolA

find_path(temmp include/foo.shoe)
message("temmp= ${temmp}")

404-页面不存在页面不存在.输出为x1m2 n1该高速缓存变量存在,因此变量(temmp)未被更改。
我尝试用这个来清除该高速缓存var:

set (temmp "" CACHE INTERNAL "")
find_path(temmp include/help.h)
message("temmp= ${temmp}")

无更改。变量被清除,但仍然存在。输出为temmp=find_path不运行。)
如何从该高速缓存中删除temmp变量?(我想强制find_path再次运行。)

s4n0splo

s4n0splo1#

可以使用unset

unset(temmp CACHE)

顺便说一下,find_path调用应该更像是:

find_path(temmp help.h include)

相关问题