How to clear / delete cache variable

Trying to get find_pathto do what I want.

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

help.h found. Output signaltemmp= /usr/local/toolA

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

foo.shoe does not exist (not found). Output A temmp= /usr/local/toolA cache variable exists, so the variable (temmp) is not affected.

I am trying to clear the var cache with this:

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

Without changes. The variable is cleared, but still exists. Output signal temmp= ( find_pathdoes not start.)

How can I remove a variable temmpfrom the cache? (I want it to find_pathstart up again.)

+5
source share
1 answer

You can use unset:

unset(temmp CACHE)

Aside, find_pathshould be more like

find_path(temmp help.h include)
+9
source

All Articles