ENH: add mark as not advanced to mark as advanced

This commit is contained in:
Bill Hoffman 2001-12-07 15:47:39 -05:00
parent f52a304728
commit 8e5f3bb9e1
5 changed files with 60 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -84,3 +84,32 @@ SET (CMAKE_MODULE_SUFFIX ".dll" CACHE STRING
"Module library suffix.")
FIND_PROGRAM(CMAKE_MAKE_PROGRAM make ${BCB_BIN_PATH})
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_DEBUG
CMAKE_LINKER_FLAGS
CMAKE_LINKER_FLAGS_MINSIZEREL
CMAKE_LINKER_FLAGS_RELEASE
CMAKE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_USE_WIN32_THREADS
CMAKE_STANDARD_WINDOWS_LIBRARIES
CMAKE_SHLIB_SUFFIX
CMAKE_MODULE_SUFFIX
CMAKE_OBJECT_FILE_SUFFIX
CMAKE_EXECUTABLE_SUFFIX
CMAKE_STATICLIB_SUFFIX
CMAKE_SHLIB_SUFFIX
CMAKE_MODULE_SUFFIX
CMAKE_LINKER_FLAGS
CMAKE_LINKER_FLAGS_DEBUG
CMAKE_LINKER_FLAGS_MINSIZEREL
CMAKE_LINKER_FLAGS_RELEASE
CMAKE_LINKER_FLAGS_RELWITHDEBINFO
)
MARK_AS_ADVANCED( CLEAR
TCL_LIBRARY
TK_LIBRARY)