summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-07-31 11:16:29 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-07-31 22:36:11 (GMT)
commit43558156d451b605bb9a3d14d53a3896ea98d73a (patch)
treeb90947442b7849048df95e1b088ff68af36c0cd1
parent0cecc7b485774be084a6d5a72e743ed9893daa5d (diff)
downloadCMake-43558156d451b605bb9a3d14d53a3896ea98d73a.zip
CMake-43558156d451b605bb9a3d14d53a3896ea98d73a.tar.gz
CMake-43558156d451b605bb9a3d14d53a3896ea98d73a.tar.bz2
cmTarget: Add NAME property
In generator expression contexts, this can be used to determine the name of the head target in the evaluation.
-rw-r--r--Source/cmTarget.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 560f07c..667c685 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -945,6 +945,11 @@ void cmTarget::DefineProperties(cmake *cm)
"OSX_ARCHITECTURES.");
cm->DefineProperty
+ ("NAME", cmProperty::TARGET,
+ "Logical name for the target.",
+ "Read-only logical name for the target as used by CMake.");
+
+ cm->DefineProperty
("EXPORT_NAME", cmProperty::TARGET,
"Exported name for target files.",
"This sets the name for the IMPORTED target generated when it this "
@@ -2971,7 +2976,13 @@ void cmTarget::SetProperty(const char* prop, const char* value)
{
return;
}
-
+ if (strcmp(prop, "NAME") == 0)
+ {
+ cmOStringStream e;
+ e << "NAME property is read-only\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return;
+ }
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
{
cmListFileBacktrace lfbt;
@@ -3038,6 +3049,13 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
{
return;
}
+ if (strcmp(prop, "NAME") == 0)
+ {
+ cmOStringStream e;
+ e << "NAME property is read-only\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return;
+ }
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
{
cmListFileBacktrace lfbt;
@@ -4053,6 +4071,11 @@ const char *cmTarget::GetProperty(const char* prop,
return 0;
}
+ if (strcmp(prop, "NAME") == 0)
+ {
+ return this->GetName();
+ }
+
// Watch for special "computed" properties that are dependent on
// other properties or variables. Always recompute them.
if(this->GetType() == cmTarget::EXECUTABLE ||