summaryrefslogtreecommitdiffstats
path: root/Source/cmGetPropertyCommand.cxx
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2014-05-15 17:12:40 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-28 16:28:18 (GMT)
commit15a8af21e8bd8354dfff2063e01f695f85efdeb8 (patch)
treeb7d98cab3ba63f61074a4f63a250934f0294826a /Source/cmGetPropertyCommand.cxx
parent032961c6ac81d82270a7b1986935111aa5e32a56 (diff)
downloadCMake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.zip
CMake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.tar.gz
CMake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.tar.bz2
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.
Diffstat (limited to 'Source/cmGetPropertyCommand.cxx')
-rw-r--r--Source/cmGetPropertyCommand.cxx37
1 files changed, 36 insertions, 1 deletions
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 512d789..9a88191 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -67,12 +67,16 @@ bool cmGetPropertyCommand
{
scope = cmProperty::CACHE;
}
+ else if(args[1] == "INSTALL")
+ {
+ scope = cmProperty::INSTALL;
+ }
else
{
cmOStringStream e;
e << "given invalid scope " << args[1] << ". "
<< "Valid scopes are "
- << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE.";
+ << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL.";
this->SetError(e.str());
return false;
}
@@ -190,6 +194,7 @@ bool cmGetPropertyCommand
case cmProperty::TEST: return this->HandleTestMode();
case cmProperty::VARIABLE: return this->HandleVariableMode();
case cmProperty::CACHE: return this->HandleCacheMode();
+ case cmProperty::INSTALL: return this->HandleInstallMode();
case cmProperty::CACHED_VARIABLE:
break; // should never happen
@@ -395,3 +400,33 @@ bool cmGetPropertyCommand::HandleCacheMode()
this->StoreResult(value);
return true;
}
+
+//----------------------------------------------------------------------------
+bool cmGetPropertyCommand::HandleInstallMode()
+{
+ if(this->Name.empty())
+ {
+ this->SetError("not given name for INSTALL scope.");
+ return false;
+ }
+
+ // Get the installed file.
+ cmake* cm = this->Makefile->GetCMakeInstance();
+
+ if(cmInstalledFile* file = cm->GetOrCreateInstalledFile(
+ this->Makefile, this->Name))
+ {
+ std::string value;
+ bool isSet = file->GetProperty(this->PropertyName, value);
+
+ return this->StoreResult(isSet ? value.c_str() : 0);
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "given INSTALL name that could not be found or created: "
+ << this->Name;
+ this->SetError(e.str());
+ return false;
+ }
+}