Bläddra i källkod

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.
Brad King 17 år sedan
förälder
incheckning
254782ed76
2 ändrade filer med 14 tillägg och 1 borttagningar
  1. 10 1
      Source/cmExportInstallFileGenerator.cxx
  2. 4 0
      Source/cmExportInstallFileGenerator.h

+ 10 - 1
Source/cmExportInstallFileGenerator.cxx

@@ -27,6 +27,15 @@ cmExportInstallFileGenerator
 {
 {
 }
 }
 
 
+//----------------------------------------------------------------------------
+std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
+{
+  std::string glob = this->FileBase;
+  glob += "-*";
+  glob += this->FileExt;
+  return glob;
+}
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 {
 {
@@ -55,7 +64,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
   os << "# Load information for each installed configuration.\n"
   os << "# Load information for each installed configuration.\n"
      << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"
      << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"
      << "FILE(GLOB CONFIG_FILES \"${_DIR}/"
      << "FILE(GLOB CONFIG_FILES \"${_DIR}/"
-     << this->FileBase << "-*" << this->FileExt << "\")\n"
+     << this->GetConfigImportFileGlob() << "\")\n"
      << "FOREACH(f ${CONFIG_FILES})\n"
      << "FOREACH(f ${CONFIG_FILES})\n"
      << "  INCLUDE(${f})\n"
      << "  INCLUDE(${f})\n"
      << "ENDFOREACH(f)\n"
      << "ENDFOREACH(f)\n"

+ 4 - 0
Source/cmExportInstallFileGenerator.h

@@ -59,6 +59,10 @@ public:
       for installation.  */
       for installation.  */
   std::map<cmStdString, cmStdString> const& GetConfigImportFiles()
   std::map<cmStdString, cmStdString> const& GetConfigImportFiles()
     { return this->ConfigImportFiles; }
     { return this->ConfigImportFiles; }
+
+  /** Compute the globbing expression used to load per-config import
+      files from the main file.  */
+  std::string GetConfigImportFileGlob();
 protected:
 protected:
 
 
   // Implement virtual methods from the superclass.
   // Implement virtual methods from the superclass.