diff options
author | Brad King <brad.king@kitware.com> | 2015-09-22 10:14:49 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-09-22 10:25:58 -0400 |
commit | 03bfe71ae055ed9e5dbeb619967ee44e5f555459 (patch) | |
tree | fd1344e66b17d48cc94e4c3901373e657d67bbd6 /Source/cmGlobalVisualStudioGenerator.cxx | |
parent | dce7d8befb94e2531d6c7d68b78b4b4a67ca024f (diff) | |
download | cmake-03bfe71ae055ed9e5dbeb619967ee44e5f555459.tar.gz |
VS: Refactor target ordering logic
Refactor cmGlobalVisualStudioGenerator::TargetCompare to store the name of
the target that should come first instead of hard-coding "ALL_BUILD".
Update client sites to specify "ALL_BUILD" when ordering for .sln files
and an empty string otherwise (in cases when "ALL_BUILD" should not be
encountered anyway).
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 2bf04b4c04..e7cc8ffe6a 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -864,28 +864,34 @@ bool cmGlobalVisualStudioGenerator::TargetCompare ::operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const { - // Make sure ALL_BUILD is first so it is the default active project. - if(r->GetName() == "ALL_BUILD") + // Make sure a given named target is ordered first, + // e.g. to set ALL_BUILD as the default active project. + // When the empty string is named this is a no-op. + if (r->GetName() == this->First) { return false; } - if(l->GetName() == "ALL_BUILD") + if (l->GetName() == this->First) { return true; } - return strcmp(l->GetName().c_str(), r->GetName().c_str()) < 0; + return l->GetName() < r->GetName(); } //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::OrderedTargetDependSet -::OrderedTargetDependSet(TargetDependSet const& targets) +::OrderedTargetDependSet(TargetDependSet const& targets, + std::string const& first): + derived(TargetCompare(first)) { this->insert(targets.begin(), targets.end()); } //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::OrderedTargetDependSet -::OrderedTargetDependSet(TargetSet const& targets) +::OrderedTargetDependSet(TargetSet const& targets, + std::string const& first): + derived(TargetCompare(first)) { for (TargetSet::const_iterator it = targets.begin(); it != targets.end(); ++it) |