From 254782ed7607db23bf65acc780f6c014eb16985c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Jan 2009 14:16:28 -0500 Subject: ENH: Refactor computation of import file glob New method cmExportInstallFileGenerator::GetConfigImportFileGlob computes the globbing expression that an installed export file uses to load its per-configuration support files. --- Source/cmExportInstallFileGenerator.cxx | 11 ++++++++++- Source/cmExportInstallFileGenerator.h | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index c71336a..532444f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -28,6 +28,15 @@ cmExportInstallFileGenerator } //---------------------------------------------------------------------------- +std::string cmExportInstallFileGenerator::GetConfigImportFileGlob() +{ + std::string glob = this->FileBase; + glob += "-*"; + glob += this->FileExt; + return glob; +} + +//---------------------------------------------------------------------------- bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { // Create all the imported targets. @@ -55,7 +64,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) os << "# Load information for each installed configuration.\n" << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" << "FILE(GLOB CONFIG_FILES \"${_DIR}/" - << this->FileBase << "-*" << this->FileExt << "\")\n" + << this->GetConfigImportFileGlob() << "\")\n" << "FOREACH(f ${CONFIG_FILES})\n" << " INCLUDE(${f})\n" << "ENDFOREACH(f)\n" diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index ffe05f7..9efa924 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -59,6 +59,10 @@ public: for installation. */ std::map const& GetConfigImportFiles() { return this->ConfigImportFiles; } + + /** Compute the globbing expression used to load per-config import + files from the main file. */ + std::string GetConfigImportFileGlob(); protected: // Implement virtual methods from the superclass. -- cgit v0.12