Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear/delete a cache variable

Tags:

cmake

Trying to get find_path to do what I want.

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

help.h is found. The output is temmp= /usr/local/toolA

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

foo.shoe does not exist (not found). The output is temmp= /usr/local/toolA The cache variable exists, so the variable (temmp) is untouched.

I try and clear the cache var with this:

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

No change. The variable is cleared, but still exists. The output is temmp= (find_path does not run.)

How can I delete the temmp variable from the cache? (I want to force the find_path to run again.)

like image 669
Doug Avatar asked Apr 30 '13 20:04

Doug


People also ask

How to remove cache in js?

You can also disable browser caching with meta HTML tags just put html tags in the head section to avoid the web page to be cached while you are coding/testing and when you are done you can remove the meta tags. Refresh your page after pasting this in the head and should refresh the new javascript code too.

How do you unset a variable in CMake?

To force a variable reference of the form ${VAR} to return an empty string, use set(<variable> "") , which clears the normal variable but leaves it defined. If PARENT_SCOPE is present then the variable is removed from the scope above the current scope. See the same option in the set() command for further details.

What is Cache variable in CMake?

The CMake cache may be thought of as a configuration file. The first time CMake is run on a project, it produces a CMakeCache. txt file in the top directory of the build tree. CMake uses this file to store a set of global cache variables, whose values persist across multiple runs within a project build tree.


1 Answers

You can use unset:

unset(temmp CACHE)

As an aside, the find_path calls should be more like:

find_path(temmp help.h include)
like image 138
Fraser Avatar answered Sep 19 '22 18:09

Fraser