summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-22 17:05:17 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-22 17:05:17 (GMT)
commitfe4c1fb32e877ea36c6882cefe4e773157573903 (patch)
tree71253a2da216e1b2a54626a7e88ed8eb1976c7d4 /Source/cmTarget.cxx
parentd337cb402fa1935a39792a51739c7a9971202414 (diff)
parentb5d6f5dd5b894ea6dcd8f87e1925db5551f3ffc0 (diff)
downloadCMake-fe4c1fb32e877ea36c6882cefe4e773157573903.zip
CMake-fe4c1fb32e877ea36c6882cefe4e773157573903.tar.gz
CMake-fe4c1fb32e877ea36c6882cefe4e773157573903.tar.bz2
Merge topic 'add-EXPORT_NAME-property'
b5d6f5d Add EXPORT_NAME property.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d0227ec..9154e0c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -868,6 +868,13 @@ void cmTarget::DefineProperties(cmake *cm)
"OSX_ARCHITECTURES.");
cm->DefineProperty
+ ("EXPORT_NAME", cmProperty::TARGET,
+ "Exported name for target files.",
+ "This sets the name for the IMPORTED target generated when it this "
+ "target is is exported. "
+ "If not set, the logical target name is used by default.");
+
+ cm->DefineProperty
("OUTPUT_NAME", cmProperty::TARGET,
"Output name for target files.",
"This sets the base name for output files created for an executable or "
@@ -2722,6 +2729,14 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::IncludeDirectoriesEntry(cge));
return;
}
+ if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
+ {
+ cmOStringStream e;
+ e << "EXPORT_NAME property can't be set on imported targets (\""
+ << this->Name << "\")\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return;
+ }
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
this->Internal->LinkInterfaceIncludeDirectoriesEntries.clear();
@@ -2756,6 +2771,14 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::IncludeDirectoriesEntry(ge.Parse(value)));
return;
}
+ if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
+ {
+ cmOStringStream e;
+ e << "EXPORT_NAME property can't be set on imported targets (\""
+ << this->Name << "\")\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ return;
+ }
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
if (cmGeneratorExpression::IsValidTargetName(value)
@@ -2773,6 +2796,26 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
}
//----------------------------------------------------------------------------
+const char* cmTarget::GetExportName()
+{
+ const char *exportName = this->GetProperty("EXPORT_NAME");
+
+ if (exportName && *exportName)
+ {
+ if (!cmGeneratorExpression::IsValidTargetName(exportName))
+ {
+ cmOStringStream e;
+ e << "EXPORT_NAME property \"" << exportName << "\" for \""
+ << this->GetName() << "\": is not valid.";
+ cmSystemTools::Error(e.str().c_str());
+ return "";
+ }
+ return exportName;
+ }
+ return this->GetName();
+}
+
+//----------------------------------------------------------------------------
void cmTarget::AppendBuildInterfaceIncludes()
{
if(this->GetType() != cmTarget::SHARED_LIBRARY &&