This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via ba1212b74ec3437eed781c30c7e957dbe6ef1b91 (commit) via a6cb7787827e7078811167ac0747f6d0510dfdf5 (commit) via 42506e232ad5da49e91a8a42d4af332bb16603f4 (commit) from b7755a73594d41497819eb90197a94eeb7b4b46b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba1212b74ec3437eed781c30c7e957dbe6ef1b91 commit ba1212b74ec3437eed781c30c7e957dbe6ef1b91 Merge: b7755a7 a6cb778 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Nov 21 11:32:19 2011 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Mon Nov 21 11:32:19 2011 -0500 Merge topic 'CheckImportedFileExistenceInConfigDotCMakeFiles' into next a6cb778 install(EXPORT): Improve target import failure message format 42506e2 install(EXPORT): Enforce existence of imported target files http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6cb7787827e7078811167ac0747f6d0510dfdf5 commit a6cb7787827e7078811167ac0747f6d0510dfdf5 Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu Nov 17 16:39:24 2011 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Nov 21 11:31:25 2011 -0500 install(EXPORT): Improve target import failure message format diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 7777373..c4f5dfb 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -385,19 +385,16 @@ cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) "FOREACH(target ${_IMPORT_CHECK_TARGETS} )\n" " FOREACH(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n" " IF(NOT EXISTS \"${file}\" )\n" - " MESSAGE(FATAL_ERROR \"The imported target \\\"${target}\\\" " - "references the file \\\"${file}\\\", but this file does not exist. " - "There are multiple possible reasons:\n" - " * The file \\\"${file}\\\" has been manually " - "deleted, renamed or moved to another location.\n" - " * A previous install or uninstall procedure did not complete " - " successfully.\n" - " * The installation package was faulty, and contained\n" - "\\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n" - "but not\n" - "\\\"${file}\\\"\n" - "which must always be installed together.\\n\"\n" - " )\n" + " MESSAGE(FATAL_ERROR \"The imported target \\\"${target}\\\"" + " references the file\n" + " \\\"${file}\\\"\n" + "but this file does not exist. Possible reasons include:\n" + "* The file was deleted, renamed, or moved to another location.\n" + "* An install or uninstall procedure did not complete successfully.\n" + "* The installation package was faulty and contained\n" + " \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n" + "but not all the files it references.\n" + "\")\n" " ENDIF()\n" " ENDFOREACH()\n" " UNSET(_IMPORT_CHECK_FILES_FOR_${target})\n" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42506e232ad5da49e91a8a42d4af332bb16603f4 commit 42506e232ad5da49e91a8a42d4af332bb16603f4 Author: Alex Neundorf <neund...@kde.org> AuthorDate: Sat Nov 12 18:12:07 2011 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Nov 21 11:26:35 2011 -0500 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 diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 7e73e36..1f8a2e2 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -68,7 +68,9 @@ cmExportBuildFileGenerator // Collect import properties for this target. cmTarget* target = *tei; ImportPropertyMap properties; - this->SetImportLocationProperty(config, suffix, target, properties); + std::set<std::string> importedLocations; + this->SetImportLocationProperty(config, suffix, target, properties, + importedLocations); if(!properties.empty()) { // Get the rest of the target details. @@ -85,13 +87,15 @@ cmExportBuildFileGenerator this->GenerateImportPropertyCode(os, config, target, properties); } } + } //---------------------------------------------------------------------------- void cmExportBuildFileGenerator ::SetImportLocationProperty(const char* config, std::string const& suffix, - cmTarget* target, ImportPropertyMap& properties) + cmTarget* target, ImportPropertyMap& properties, + std::set<std::string>& importedLocations) { // Get the makefile in which to lookup target information. cmMakefile* mf = target->GetMakefile(); @@ -110,6 +114,7 @@ cmExportBuildFileGenerator value = target->GetFullPath(config, false, true); } properties[prop] = value; + importedLocations.insert(prop); } // Check whether this is a DLL platform. @@ -126,6 +131,7 @@ cmExportBuildFileGenerator prop += suffix; std::string value = target->GetFullPath(config, true); properties[prop] = value; + importedLocations.insert(prop); } } diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 0f37626..18be68e 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -52,7 +52,8 @@ protected: void SetImportLocationProperty(const char* config, std::string const& suffix, cmTarget* target, - ImportPropertyMap& properties); + ImportPropertyMap& properties, + std::set<std::string>& importedLocations); std::vector<cmTarget*> const* Exports; cmExportCommand* ExportCommand; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9e5c91e..7777373 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -368,3 +368,69 @@ cmExportFileGenerator os << " )\n" << "\n"; } + + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os) +{ + // Add code which verifies at cmake time that the file which is being + // imported actually exists on disk. This should in theory always be theory + // case, but still when packages are split into normal and development + // packages this might get broken (e.g. the Config.cmake could be part of + // the non-development package, something similar happened to me without + // on SUSE with a mysql pkg-config file, which claimed everything is fine, + // but the development package was not installed.). + os << "# Loop over all imported files and verify that they actually exist\n" + "FOREACH(target ${_IMPORT_CHECK_TARGETS} )\n" + " FOREACH(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n" + " IF(NOT EXISTS \"${file}\" )\n" + " MESSAGE(FATAL_ERROR \"The imported target \\\"${target}\\\" " + "references the file \\\"${file}\\\", but this file does not exist. " + "There are multiple possible reasons:\n" + " * The file \\\"${file}\\\" has been manually " + "deleted, renamed or moved to another location.\n" + " * A previous install or uninstall procedure did not complete " + " successfully.\n" + " * The installation package was faulty, and contained\n" + "\\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n" + "but not\n" + "\\\"${file}\\\"\n" + "which must always be installed together.\\n\"\n" + " )\n" + " ENDIF()\n" + " ENDFOREACH()\n" + " UNSET(_IMPORT_CHECK_FILES_FOR_${target})\n" + "ENDFOREACH()\n" + "UNSET(_IMPORT_CHECK_TARGETS)\n" + "\n"; +} + + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator +::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, + ImportPropertyMap const& properties, + const std::set<std::string>& importedLocations) +{ + // Construct the imported target name. + std::string targetName = this->Namespace; + targetName += target->GetName(); + + os << "LIST(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n" + "LIST(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " "; + + for(std::set<std::string>::const_iterator li = importedLocations.begin(); + li != importedLocations.end(); + ++li) + { + ImportPropertyMap::const_iterator pi = properties.find(*li); + if (pi != properties.end()) + { + os << "\"" << pi->second << "\" "; + } + } + + os << ")\n\n"; +} diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 05f73a2..f271e55 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -56,6 +56,11 @@ protected: void GenerateImportPropertyCode(std::ostream& os, const char* config, cmTarget* target, ImportPropertyMap const& properties); + void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, + ImportPropertyMap const& properties, + const std::set<std::string>& importedLocations); + void GenerateImportedFileCheckLoop(std::ostream& os); + // Collect properties with detailed information about targets beyond // their location on disk. 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); } } diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 8c8fb44..fb678e8 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -75,7 +75,9 @@ protected: void SetImportLocationProperty(const char* config, std::string const& suffix, cmInstallTargetGenerator* itgen, - ImportPropertyMap& properties); + ImportPropertyMap& properties, + std::set<std::string>& importedLocations + ); void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits