summaryrefslogtreecommitdiffstats
path: root/Source/cmExportInstallFileGenerator.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-11-12 17:12:07 (GMT)
committerBrad King <brad.king@kitware.com>2011-11-22 20:55:00 (GMT)
commita2be068c75890a9b6723c0bbb2d32a108cb84eed (patch)
tree782be0b5570258cae5fdf292081eacf9120082a7 /Source/cmExportInstallFileGenerator.cxx
parentb90b6969f68950d57e6ba23fa92780c78c804218 (diff)
downloadCMake-a2be068c75890a9b6723c0bbb2d32a108cb84eed.zip
CMake-a2be068c75890a9b6723c0bbb2d32a108cb84eed.tar.gz
CMake-a2be068c75890a9b6723c0bbb2d32a108cb84eed.tar.bz2
install(EXPORT): Enforce existence of imported target files
Typical <package>Config.cmake files for find_package() rely only on the files generated by install(EXPORT). They might be wrong, for whatever reasons, like people manually deleted files, projects were packaged wrong by distributions, whatever. To protect against this, add checks that the file locations we are importing actually exist on disk. Alex
Diffstat (limited to 'Source/cmExportInstallFileGenerator.cxx')
-rw-r--r--Source/cmExportInstallFileGenerator.cxx30
1 files changed, 20 insertions, 10 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 23ff5fb..da14dd7 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -167,16 +167,18 @@ cmExportInstallFileGenerator
// Collect import properties for this target.
cmTargetExport* te = *tei;
ImportPropertyMap properties;
+ std::set<std::string> importedLocations;
+ this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
+ properties, importedLocations);
+ this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
+ properties, importedLocations);
this->SetImportLocationProperty(config, suffix,
- te->ArchiveGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->LibraryGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->RuntimeGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->FrameworkGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->BundleGenerator, properties);
+ te->RuntimeGenerator, properties,
+ importedLocations);
+ this->SetImportLocationProperty(config, suffix, te->FrameworkGenerator,
+ properties, importedLocations);
+ this->SetImportLocationProperty(config, suffix, te->BundleGenerator,
+ properties, importedLocations);
// If any file location was set for the target add it to the
// import file.
@@ -194,9 +196,13 @@ cmExportInstallFileGenerator
// Generate code in the export file.
this->GenerateImportPropertyCode(os, config, te->Target, properties);
+ this->GenerateImportedFileChecksCode(os, te->Target, properties,
+ importedLocations);
}
}
+ this->GenerateImportedFileCheckLoop(os);
+
// Cleanup the import prefix variable.
if(!this->ImportPrefix.empty())
{
@@ -211,7 +217,9 @@ void
cmExportInstallFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
cmInstallTargetGenerator* itgen,
- ImportPropertyMap& properties)
+ ImportPropertyMap& properties,
+ std::set<std::string>& importedLocations
+ )
{
// Skip rules that do not match this configuration.
if(!(itgen && itgen->InstallsForConfig(config)))
@@ -249,6 +257,7 @@ cmExportInstallFileGenerator
// Store the property.
properties[prop] = value;
+ importedLocations.insert(prop);
}
else
{
@@ -291,6 +300,7 @@ cmExportInstallFileGenerator
// Store the property.
properties[prop] = value;
+ importedLocations.insert(prop);
}
}