summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallTargetsCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-14 17:42:27 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-14 18:50:39 (GMT)
commit9d11bd50661a1fb0a079c7c17120273f21ea9a8c (patch)
tree3e02a1c74e8594c0cbe97b5ad71035a84618adb9 /Source/cmInstallTargetsCommand.cxx
parentd97513d842c51e4fb996d42e1f04a9c291e3d5bf (diff)
downloadCMake-9d11bd50661a1fb0a079c7c17120273f21ea9a8c.zip
CMake-9d11bd50661a1fb0a079c7c17120273f21ea9a8c.tar.gz
CMake-9d11bd50661a1fb0a079c7c17120273f21ea9a8c.tar.bz2
Avoid requiring default cmTarget constructor for map indexing
The `std::map<>` index operator requires a default constructor on the value type. Avoid requiring a default constructor on `cmTarget` just for this purpose.
Diffstat (limited to 'Source/cmInstallTargetsCommand.cxx')
-rw-r--r--Source/cmInstallTargetsCommand.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 056ea24..6b594b6 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -37,14 +37,17 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
}
runtime_dir = *s;
- } else if (tgts.find(*s) != tgts.end()) {
- tgts[*s].SetInstallPath(args[0].c_str());
- tgts[*s].SetRuntimeInstallPath(runtime_dir.c_str());
- tgts[*s].SetHaveInstallRule(true);
} else {
- std::string str = "Cannot find target: \"" + *s + "\" to install.";
- this->SetError(str);
- return false;
+ cmTargets::iterator ti = tgts.find(*s);
+ if (ti != tgts.end()) {
+ ti->second.SetInstallPath(args[0].c_str());
+ ti->second.SetRuntimeInstallPath(runtime_dir.c_str());
+ ti->second.SetHaveInstallRule(true);
+ } else {
+ std::string str = "Cannot find target: \"" + *s + "\" to install.";
+ this->SetError(str);
+ return false;
+ }
}
}