summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-10-09 19:48:59 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-10-09 19:48:59 (GMT)
commitf990777a605f200d00aa5ba980c1acbdc9446ed9 (patch)
tree0eb930f8cf5e3da811220f99f93f8bb780e611a0
parentcb5763a410181512f762088a2de7338f65181170 (diff)
downloadCMake-f990777a605f200d00aa5ba980c1acbdc9446ed9.zip
CMake-f990777a605f200d00aa5ba980c1acbdc9446ed9.tar.gz
CMake-f990777a605f200d00aa5ba980c1acbdc9446ed9.tar.bz2
added FORCE option
-rw-r--r--Source/cmSetCommand.cxx18
-rw-r--r--Source/cmSetCommand.h5
2 files changed, 15 insertions, 8 deletions
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 083f422..df3240e 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -39,6 +39,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
const char* variable = args[0].c_str(); // VAR is always first
std::string value; // optional
bool cache = false; // optional
+ bool force = false; // optional
cmCacheManager::CacheEntryType type = cmCacheManager::STRING; // required if cache
const char* docstring = 0; // required if cache
std::string::size_type cacheStart = 0;
@@ -60,19 +61,24 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
}
}
-
+ // look for FORCE argument
+ if (args.size() > 4 && args[args.size()-1] == "FORCE")
+ {
+ force = true;
+ }
+
if(args.size() == 2)
{
- // SET (VAR value )
- value= args[1];
+ // SET (VAR value )
+ value= args[1];
}
- else if(args.size() == 4)
+ else if(args.size() == 4 + (force ? 1 : 0))
{
// SET (VAR CACHE TYPE "doc String")
cache = true;
cacheStart = 1;
}
- else if(args.size() == 5)
+ else if(args.size() == 5 + (force ? 1 : 0))
{
// SET (VAR value CACHE TYPE "doc string")
cache = true;
@@ -116,7 +122,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
// is already in the cache and the type is not internal
// then leave now without setting any definitions in the cache
// or the makefile
- if(cache && type != cmCacheManager::INTERNAL)
+ if(cache && type != cmCacheManager::INTERNAL && !force)
{
return true;
}
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 2b55bd9..76a14d9 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -67,14 +67,15 @@ public:
virtual const char* GetFullDocumentation()
{
return
- "SET(VAR [VALUE] [CACHE TYPE DOCSTRING])\n"
+ "SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]])\n"
"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."
" 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 "
"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. The FORCE option will overwrite"
+ "the CACHE value removing any changes from the USER.\n"
"An optional syntax is SET(VAR VALUE1 ... VALUEN).\n"
"In this case VAR is set to a ; separated list of values.";
}