summaryrefslogtreecommitdiffstats
path: root/Source/cmMarkAsAdvancedCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-12-07 20:47:39 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-12-07 20:47:39 (GMT)
commit8e5f3bb9e1fac42d3adef98858b6c3411de584e5 (patch)
treef8ff44049c1fc4e986bac65e094a126d9722082a /Source/cmMarkAsAdvancedCommand.cxx
parentf52a30472833dd06591ada9c685e51d2963cc823 (diff)
downloadCMake-8e5f3bb9e1fac42d3adef98858b6c3411de584e5.zip
CMake-8e5f3bb9e1fac42d3adef98858b6c3411de584e5.tar.gz
CMake-8e5f3bb9e1fac42d3adef98858b6c3411de584e5.tar.bz2
ENH: add mark as not advanced to mark as advanced
Diffstat (limited to 'Source/cmMarkAsAdvancedCommand.cxx')
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx25
1 files changed, 21 insertions, 4 deletions
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index ed7d7a5..1187c16 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -48,15 +48,32 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("called with incorrect number of arguments");
return false;
}
- for(unsigned int i =0; i < args.size(); ++i)
+ unsigned int i =0;
+ const char* value = "1";
+ bool overwrite = false;
+ if(args[0] == "CLEAR" || args[0] == "FORCE")
+ {
+ overwrite = true;
+ if(args[0] == "CLEAR")
+ {
+ value = "0";
+ }
+ i = 1;
+ }
+ for(; i < args.size(); ++i)
{
std::string variable = args[i];
variable += "-ADVANCED";
std::string doc = "Advanced flag for variable: ";
doc += args[i];
- m_Makefile->AddCacheDefinition(variable.c_str(), "1",
- doc.c_str(),
- cmCacheManager::INTERNAL);
+ // if not CLEAR or FORCE or it is not yet defined,
+ // then define variable-ADVANCED
+ if(overwrite || !m_Makefile->GetDefinition(variable.c_str()))
+ {
+ m_Makefile->AddCacheDefinition(variable.c_str(), value,
+ doc.c_str(),
+ cmCacheManager::INTERNAL);
+ }
}
return true;
}