summaryrefslogtreecommitdiffstats
path: root/Source/cmExportInstallFileGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-02-06 19:20:36 (GMT)
committerBrad King <brad.king@kitware.com>2008-02-06 19:20:36 (GMT)
commit9e64d5b272e0279d4a6d5e595118f34bc3c1f6c9 (patch)
tree91922579fd8e7264d435c8492e775fe777db611f /Source/cmExportInstallFileGenerator.cxx
parentafad12431371d9a725b9a85db39f8c4da37fabaf (diff)
downloadCMake-9e64d5b272e0279d4a6d5e595118f34bc3c1f6c9.zip
CMake-9e64d5b272e0279d4a6d5e595118f34bc3c1f6c9.tar.gz
CMake-9e64d5b272e0279d4a6d5e595118f34bc3c1f6c9.tar.bz2
ENH: Improve exporting/importing of targets
- Use real name instead of link for location of versioned targets - Error when a target is exported multiple times
Diffstat (limited to 'Source/cmExportInstallFileGenerator.cxx')
-rw-r--r--Source/cmExportInstallFileGenerator.cxx74
1 files changed, 52 insertions, 22 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 07f99cf..c71336a 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -36,8 +36,19 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
tei != this->ExportSet->end(); ++tei)
{
cmTargetExport* te = *tei;
- this->ExportedTargets.insert(te->Target);
- this->GenerateImportTargetCode(os, te->Target);
+ if(this->ExportedTargets.insert(te->Target).second)
+ {
+ this->GenerateImportTargetCode(os, te->Target);
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "INSTALL(EXPORT \"" << this->Name << "\" ...) "
+ << "includes target \"" << te->Target->GetName()
+ << "\" more than once in the export set.";
+ cmSystemTools::Error(e.str().c_str());
+ return false;
+ }
}
// Now load per-configuration properties for them.
@@ -204,11 +215,8 @@ cmExportInstallFileGenerator
return;
}
- {
- // Construct the property name.
- std::string prop = (itgen->IsImportLibrary()?
- "IMPORTED_IMPLIB" : "IMPORTED_LOCATION");
- prop += suffix;
+ // Get the target to be installed.
+ cmTarget* target = itgen->GetTarget();
// Construct the installed location of the target.
std::string dest = itgen->GetDestination();
@@ -225,25 +233,47 @@ cmExportInstallFileGenerator
value += dest;
value += "/";
- // Append the installed file name.
- std::string fname = itgen->GetInstallFilename(config);
- value += fname;
-
- // Fix name for frameworks and bundles.
- if(itgen->GetTarget()->IsFrameworkOnApple())
+ if(itgen->IsImportLibrary())
{
- value += ".framework/";
- value += fname;
+ // Construct the property name.
+ std::string prop = "IMPORTED_IMPLIB";
+ prop += suffix;
+
+ // Append the installed file name.
+ value += itgen->GetInstallFilename(target, config,
+ cmInstallTargetGenerator::NameImplib);
+
+ // Store the property.
+ properties[prop] = value;
}
- else if(itgen->GetTarget()->IsAppBundleOnApple())
+ else
{
- value += ".app/Contents/MacOS/";
- value += fname;
- }
+ // Construct the property name.
+ std::string prop = "IMPORTED_LOCATION";
+ prop += suffix;
- // Store the property.
- properties[prop] = value;
- }
+ // Append the installed file name.
+ if(target->IsFrameworkOnApple())
+ {
+ value += itgen->GetInstallFilename(target, config);
+ value += ".framework/";
+ value += itgen->GetInstallFilename(target, config);
+ }
+ else if(target->IsAppBundleOnApple())
+ {
+ value += itgen->GetInstallFilename(target, config);
+ value += ".app/Contents/MacOS/";
+ value += itgen->GetInstallFilename(target, config);
+ }
+ else
+ {
+ value += itgen->GetInstallFilename(target, config,
+ cmInstallTargetGenerator::NameReal);
+ }
+
+ // Store the property.
+ properties[prop] = value;
+ }
}
//----------------------------------------------------------------------------