diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-12-07 20:47:39 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-12-07 20:47:39 (GMT) |
commit | 8e5f3bb9e1fac42d3adef98858b6c3411de584e5 (patch) | |
tree | f8ff44049c1fc4e986bac65e094a126d9722082a /Source | |
parent | f52a30472833dd06591ada9c685e51d2963cc823 (diff) | |
download | CMake-8e5f3bb9e1fac42d3adef98858b6c3411de584e5.zip CMake-8e5f3bb9e1fac42d3adef98858b6c3411de584e5.tar.gz CMake-8e5f3bb9e1fac42d3adef98858b6c3411de584e5.tar.bz2 |
ENH: add mark as not advanced to mark as advanced
Diffstat (limited to 'Source')
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.cpp | 4 | ||||
-rw-r--r-- | Source/cmCacheManager.cxx | 6 | ||||
-rw-r--r-- | Source/cmMarkAsAdvancedCommand.cxx | 25 | ||||
-rw-r--r-- | Source/cmMarkAsAdvancedCommand.h | 7 |
4 files changed, 31 insertions, 11 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index b95d780..b21f229 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -633,9 +633,7 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager() if(!m_AdvancedValues) { - std::string advancedVar = key; - advancedVar += "-ADVANCED"; - if(cmCacheManager::GetInstance()->GetCacheEntry(advancedVar.c_str())) + if(cmCacheManager::GetInstance()->IsAdvanced(key)) { continue; } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index a8ea49a..5392937 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -563,9 +563,11 @@ bool cmCacheManager::IsAdvanced(const char* key) { std::string advancedVar = key; advancedVar += "-ADVANCED"; - if(cmCacheManager::GetInstance()->GetCacheEntry(advancedVar.c_str())) + const char* value = + cmCacheManager::GetInstance()->GetCacheValue(advancedVar.c_str()); + if(value) { - return true; + return cmSystemTools::IsOn(value); } return false; } 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; } diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index f328667..c43d035 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -91,9 +91,12 @@ public: virtual const char* GetFullDocumentation() { return - "MARK_AS_ADVANCED(VAR VAR2 VAR... )\n" + "MARK_AS_ADVANCED([CLEAR|FORCE]VAR VAR2 VAR... )\n" "Mark the named variables as advanced. An advanced variable will not be displayed in" - " any of the cmake GUIs, unless the show advanced option is on."; + " any of the cmake GUIs, unless the show advanced option is on. " + "If CLEAR is the first argument advanced variables are changed back to unadvanced." + "If FORCE is the first arguement, then the variable is made advanced." + "If neither FORCE or CLEAR is specified, new values will be marked as advanced, but if the variable already has an advanced state, it will not be changed."; } cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand); |