summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/cmExportSetMap.cxx34
-rw-r--r--Source/cmExportSetMap.h33
-rw-r--r--Source/cmGlobalGenerator.cxx29
-rw-r--r--Source/cmGlobalGenerator.h10
-rw-r--r--Source/cmInstallCommand.cxx3
-rw-r--r--Source/cmInstallExportGenerator.cxx2
-rwxr-xr-xbootstrap1
8 files changed, 76 insertions, 38 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index e04b7c9b1e..186aa6db6d 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -178,6 +178,8 @@ set(SRCS
cmExportInstallFileGenerator.cxx
cmExportSet.h
cmExportSet.cxx
+ cmExportSetMap.h
+ cmExportSetMap.cxx
cmExtraCodeBlocksGenerator.cxx
cmExtraCodeBlocksGenerator.h
cmExtraEclipseCDT4Generator.cxx
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
new file mode 100644
index 0000000000..96fdb3e4f3
--- /dev/null
+++ b/Source/cmExportSetMap.cxx
@@ -0,0 +1,34 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmExportSetMap.h"
+#include "cmExportSet.h"
+
+cmExportSet* cmExportSetMap::operator[](const std::string &name)
+{
+ std::map<std::string, cmExportSet*>::iterator it = this->find(name);
+ if (it == this->end()) // Export set not found
+ {
+ it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
+ }
+ return it->second;
+}
+
+cmExportSetMap::~cmExportSetMap()
+{
+ for(std::map<std::string, cmExportSet*>::iterator it = this->begin();
+ it != this->end();
+ ++ it)
+ {
+ delete it->second;
+ }
+}
diff --git a/Source/cmExportSetMap.h b/Source/cmExportSetMap.h
new file mode 100644
index 0000000000..4663c55381
--- /dev/null
+++ b/Source/cmExportSetMap.h
@@ -0,0 +1,33 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmExportSetMap_h
+#define cmExportSetMap_h
+
+#include "cmSystemTools.h"
+class cmExportSet;
+
+/// A name -> cmExportSet map with overloaded operator[].
+class cmExportSetMap : public std::map<std::string, cmExportSet*>
+{
+public:
+ /** \brief Overloaded operator[].
+ *
+ * The operator is overloaded because cmExportSet has no default constructor:
+ * we do not want unnamed export sets.
+ */
+ cmExportSet* operator[](const std::string &name);
+
+ /// Overloaded destructor deletes all member export sets.
+ ~cmExportSetMap();
+};
+
+#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 5640af94a1..e464381e30 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1467,35 +1467,6 @@ void cmGlobalGenerator::AddInstallComponent(const char* component)
}
}
-void cmGlobalGenerator::AddTargetToExport(const char* exportSetName,
- cmTargetExport const* te)
-{
- std::map<cmStdString, cmExportSet>::iterator it = ExportSets.find(exportSetName);
- // If EXPORT named exportSetName does not exist, create it.
- if (it == ExportSets.end())
- {
- cmStdString key = exportSetName;
- cmExportSet value(key);
- it = ExportSets.insert(std::make_pair(key, value)).first;
- }
- it->second.AddTargetExport(te);
-}
-
-//----------------------------------------------------------------------------
-
-const cmExportSet *cmGlobalGenerator::GetExportSet(const char* name) const
-{
- std::map<cmStdString, cmExportSet >::const_iterator
- exportSetIt = this->ExportSets.find(name);
- if (exportSetIt != this->ExportSets.end())
- {
- return &exportSetIt->second;
- }
-
- return 0;
-}
-
-
void cmGlobalGenerator::EnableInstallTarget()
{
this->InstallTargetEnabled = true;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 568e138aa8..71c3a4d804 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -18,14 +18,13 @@
#include "cmTarget.h" // For cmTargets
#include "cmTargetDepend.h" // For cmTargetDependSet
#include "cmSystemTools.h" // for cmSystemTools::OutputOption
-#include "cmExportSet.h" // For cmExportSet
+#include "cmExportSetMap.h" // For cmExportSetMap
class cmake;
class cmGeneratorTarget;
class cmMakefile;
class cmLocalGenerator;
class cmExternalMakefileProjectGenerator;
class cmTarget;
-class cmTargetExport;
class cmInstallTargetGenerator;
class cmInstallFilesGenerator;
@@ -154,10 +153,7 @@ public:
const std::set<cmStdString>* GetInstallComponents() const
{ return &this->InstallComponents; }
- ///! Add one installed target to the sets of the exports
- void AddTargetToExport(const char* exportSet, cmTargetExport const* te);
- ///! Get the export target set with the given name
- const cmExportSet *GetExportSet(const char* name) const;
+ cmExportSetMap& GetExportSets() {return this->ExportSets;}
/** Add a file to the manifest of generated targets for a configuration. */
void AddToManifest(const char* config, std::string const& f);
@@ -329,7 +325,7 @@ protected:
std::set<cmStdString> InstallComponents;
bool InstallTargetEnabled;
// Sets of named target exports
- std::map<cmStdString, cmExportSet> ExportSets;
+ cmExportSetMap ExportSets;
// Manifest of all targets that will be built for each configuration.
// This is computed just before local generators generate.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 62fc2ef3b0..6eaa1035d8 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -18,6 +18,7 @@
#include "cmInstallExportGenerator.h"
#include "cmInstallCommandArguments.h"
#include "cmTargetExport.h"
+#include "cmExportSet.h"
#include <cmsys/Glob.hxx>
@@ -745,7 +746,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
te->LibraryGenerator = libraryGenerator;
te->RuntimeGenerator = runtimeGenerator;
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->AddTargetToExport(exports.GetCString(), te);
+ ->GetExportSets()[exports.GetString()]->AddTargetExport(te);
}
}
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index a9cd3fe128..0179cd148c 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -117,7 +117,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
// Get the export set requested.
cmExportSet const* exportSet =
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
- ->GetExportSet(this->Name.c_str());
+ ->GetExportSets()[this->Name];
// Skip empty sets.
if(!exportSet)
diff --git a/bootstrap b/bootstrap
index a9e8a86f05..d51d80f81f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -200,6 +200,7 @@ CMAKE_CXX_SOURCES="\
cmExportFileGenerator \
cmExportInstallFileGenerator \
cmExportSet \
+ cmExportSetMap \
cmInstallDirectoryGenerator \
cmGeneratedFileStream \
cmGeneratorTarget \