ENH: Define STRINGS cache entry property

This property defines a list of values for a cache entry of type STRING.
A CMake GUI may optionally use a drop-down selection widget for the
entry instead of a generic text entry field.  We do not enforce that the
value of the entry match one of the strings listed.
This commit is contained in:
Brad King 2009-03-12 10:52:40 -04:00
parent 1b43bea91c
commit dd7b48c9c3
2 changed files with 13 additions and 1 deletions

View File

@ -357,6 +357,7 @@ const char* cmCacheManager::PersistentProperties[] =
{ {
"ADVANCED", "ADVANCED",
"MODIFIED", "MODIFIED",
"STRINGS",
0 0
}; };
@ -987,6 +988,16 @@ void cmCacheManager::DefineProperties(cmake *cm)
"which creates it (set, option, find_library, etc.)." "which creates it (set, option, find_library, etc.)."
); );
cm->DefineProperty
("STRINGS", cmProperty::CACHE,
"Enumerate possible STRING entry values for GUI selection.",
"For cache entries with type STRING, this enumerates a set of values. "
"CMake GUIs may use this to provide a selection widget instead of a "
"generic string entry field. "
"This is for convenience only. "
"CMake does not enforce that the value matches one of those listed."
);
cm->DefineProperty cm->DefineProperty
("VALUE", cmProperty::CACHE, ("VALUE", cmProperty::CACHE,
"Value of a cache entry.", "Value of a cache entry.",

View File

@ -419,12 +419,13 @@ bool cmSetPropertyCommand::HandleCacheMode()
} }
} }
else if(this->PropertyName != "HELPSTRING" && else if(this->PropertyName != "HELPSTRING" &&
this->PropertyName != "STRINGS" &&
this->PropertyName != "VALUE") this->PropertyName != "VALUE")
{ {
cmOStringStream e; cmOStringStream e;
e << "given invalid CACHE property " << this->PropertyName << ". " e << "given invalid CACHE property " << this->PropertyName << ". "
<< "Settable CACHE properties are: " << "Settable CACHE properties are: "
<< "ADVANCED, HELPSTRING, TYPE, and VALUE."; << "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE.";
this->SetError(e.str().c_str()); this->SetError(e.str().c_str());
return false; return false;
} }