summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx35
1 files changed, 24 insertions, 11 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3691c47..706a45f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -25,6 +25,7 @@
#include <set>
#include <queue>
#include <stdlib.h> // required for atof
+#include <assert.h>
const char* cmTarget::TargetTypeNames[] = {
"EXECUTABLE", "STATIC_LIBRARY",
"SHARED_LIBRARY", "MODULE_LIBRARY", "UTILITY", "GLOBAL_TARGET",
@@ -42,17 +43,6 @@ cmTarget::cmTarget()
}
//----------------------------------------------------------------------------
-cmTarget::~cmTarget()
-{
- for(std::map<cmStdString, cmComputeLinkInformation*>::iterator
- i = this->LinkInformation.begin();
- i != this->LinkInformation.end(); ++i)
- {
- delete i->second;
- }
-}
-
-//----------------------------------------------------------------------------
void cmTarget::DefineProperties(cmake *cm)
{
cm->DefineProperty
@@ -3075,3 +3065,26 @@ cmTarget::GetLinkInformation(const char* config)
}
return i->second;
}
+
+//----------------------------------------------------------------------------
+cmTargetLinkInformationMap
+::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived()
+{
+ // Ideally cmTarget instances should never be copied. However until
+ // we can make a sweep to remove that, this copy constructor avoids
+ // allowing the resources (LinkInformation) from getting copied. In
+ // the worst case this will lead to extra cmComputeLinkInformation
+ // instances. We also enforce in debug mode that the map be emptied
+ // when copied.
+ static_cast<void>(r);
+ assert(r.empty());
+}
+
+//----------------------------------------------------------------------------
+cmTargetLinkInformationMap::~cmTargetLinkInformationMap()
+{
+ for(derived::iterator i = this->begin(); i != this->end(); ++i)
+ {
+ delete i->second;
+ }
+}