Commit eb6bba34 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

BUG: fix doc string and allow a variable to be promoted from non-cache to cache

parent cc6d5618
...@@ -107,19 +107,21 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args) ...@@ -107,19 +107,21 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
type = cmCacheManager::StringToType(args[cacheStart+1].c_str()); type = cmCacheManager::StringToType(args[cacheStart+1].c_str());
docstring = args[cacheStart+2].c_str(); docstring = args[cacheStart+2].c_str();
} }
// get the current cache value for the variable // see if this is already in the cache
const char* cacheValue = cmCacheManager::CacheIterator it =
m_Makefile->GetDefinition(variable); m_Makefile->GetCacheManager()->GetCacheIterator(variable);
if(cacheValue) if(!it.IsAtEnd())
{ {
// if it is not a cached value, or it is a cached // if the set is trying to CACHE the value but the value
// value that is not internal keep the value found // is already in the cache and the type is not internal
// in the cache // then leave now without setting any definitions in the cache
// or the makefile
if(cache && type != cmCacheManager::INTERNAL) if(cache && type != cmCacheManager::INTERNAL)
{ {
return true; return true;
} }
} }
// if it is meant to be in the cache then define it in the cache // if it is meant to be in the cache then define it in the cache
if(cache) if(cache)
{ {
......
...@@ -70,7 +70,8 @@ public: ...@@ -70,7 +70,8 @@ public:
"SET(VAR [VALUE] [CACHE TYPE DOCSTRING])\n" "SET(VAR [VALUE] [CACHE TYPE DOCSTRING])\n"
"Within CMAKE sets VAR to the value VALUE. VALUE is expanded before VAR " "Within CMAKE sets VAR to the value VALUE. VALUE is expanded before VAR "
"is set to it. If CACHE is present, then the VAR is put in the cache." "is set to it. If CACHE is present, then the VAR is put in the cache."
" TYPE and DOCSTRING are required. If TYPE is INTERNAL, then the " " TYPE and DOCSTRING are required. TYPE may be BOOL, PATH, FILEPATH, STRING, INTERNAL, "
"or STATIC. If TYPE is INTERNAL, then the "
" VALUE is Always written into the cache, replacing any values " " VALUE is Always written into the cache, replacing any values "
"existing in the cache. If it is not a CACHE VAR, then this always " "existing in the cache. If it is not a CACHE VAR, then this always "
"writes into the current makefile.\n" "writes into the current makefile.\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment