summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-14 18:28:07 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-14 18:50:39 (GMT)
commit00e78c19903c24bb7cc969f3b825b2502661f3c0 (patch)
tree7de3b40f4c5208560a5053e1a9b7ec39035e4164 /Source/cmMakefile.cxx
parent9d11bd50661a1fb0a079c7c17120273f21ea9a8c (diff)
downloadCMake-00e78c19903c24bb7cc969f3b825b2502661f3c0.zip
CMake-00e78c19903c24bb7cc969f3b825b2502661f3c0.tar.gz
CMake-00e78c19903c24bb7cc969f3b825b2502661f3c0.tar.bz2
cmTarget: Construct with basic information up front
Avoid having partially constructed cmTarget instances around, except for the special case of GLOBAL_TARGET construction.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eb39afa..508c670 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1925,10 +1925,10 @@ cmTarget* cmMakefile::AddNewTarget(cmState::TargetType type,
const std::string& name)
{
cmTargets::iterator it =
- this->Targets.insert(cmTargets::value_type(name, cmTarget())).first;
- cmTarget& target = it->second;
- target.SetType(type, name);
- target.SetMakefile(this);
+ this->Targets
+ .insert(cmTargets::value_type(
+ name, cmTarget(name, type, cmTarget::VisibilityNormal, this)))
+ .first;
this->GetGlobalGenerator()->IndexTarget(&it->second);
return &it->second;
}
@@ -3710,10 +3710,10 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
cmState::TargetType type, bool global)
{
// Create the target.
- CM_AUTO_PTR<cmTarget> target(new cmTarget);
- target->SetType(type, name);
- target->MarkAsImported(global);
- target->SetMakefile(this);
+ CM_AUTO_PTR<cmTarget> target(
+ new cmTarget(name, type, global ? cmTarget::VisibilityImportedGlobally
+ : cmTarget::VisibilityImported,
+ this));
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();