Add an "installed file" property scope

Teach set_property and get_property an "INSTALL" property type to be
associated with install-tree file paths.  Make the properties available
to CPack for use during packaging.  Add a "prop_inst" Sphinx domain
object type for documentation of such properties.
This commit is contained in:
Nils Gladitz
2014-05-15 19:12:40 +02:00
committed by Brad King
parent 032961c6ac
commit 15a8af21e8
42 changed files with 612 additions and 12 deletions
+58 -1
View File
@@ -61,11 +61,16 @@ bool cmSetPropertyCommand
{
scope = cmProperty::CACHE;
}
else if(*arg == "INSTALL")
{
scope = cmProperty::INSTALL;
}
else
{
cmOStringStream e;
e << "given invalid scope " << *arg << ". "
<< "Valid scopes are GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, CACHE.";
<< "Valid scopes are GLOBAL, DIRECTORY, "
"TARGET, SOURCE, TEST, CACHE, INSTALL.";
this->SetError(e.str());
return false;
}
@@ -135,6 +140,7 @@ bool cmSetPropertyCommand
case cmProperty::SOURCE_FILE: return this->HandleSourceMode();
case cmProperty::TEST: return this->HandleTestMode();
case cmProperty::CACHE: return this->HandleCacheMode();
case cmProperty::INSTALL: return this->HandleInstallMode();
case cmProperty::VARIABLE:
case cmProperty::CACHED_VARIABLE:
@@ -488,3 +494,54 @@ bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
return true;
}
//----------------------------------------------------------------------------
bool cmSetPropertyCommand::HandleInstallMode()
{
cmake* cm = this->Makefile->GetCMakeInstance();
for(std::set<std::string>::const_iterator i = this->Names.begin();
i != this->Names.end(); ++i)
{
if(cmInstalledFile* file = cm->GetOrCreateInstalledFile(
this->Makefile, *i))
{
if(!this->HandleInstall(file))
{
return false;
}
}
else
{
cmOStringStream e;
e << "given INSTALL name that could not be found or created: " << *i;
this->SetError(e.str());
return false;
}
}
return true;
}
//----------------------------------------------------------------------------
bool cmSetPropertyCommand::HandleInstall(cmInstalledFile* file)
{
// Set or append the property.
std::string const& name = this->PropertyName;
cmMakefile* mf = this->Makefile;
const char *value = this->PropertyValue.c_str();
if (this->Remove)
{
file->RemoveProperty(name);
}
else if(this->AppendMode)
{
file->AppendProperty(mf, name, value, this->AppendAsString);
}
else
{
file->SetProperty(mf, name, value);
}
return true;
}