mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
cmGlobalVisualStudioGenerator: Consolidate solution generation methods
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::string GetSLNFile(cmLocalGenerator* root)
|
std::string GetSLNFile(cmLocalGenerator const* root)
|
||||||
{
|
{
|
||||||
return cmStrCat(root->GetCurrentBinaryDirectory(), '/',
|
return cmStrCat(root->GetCurrentBinaryDirectory(), '/',
|
||||||
root->GetProjectName(), ".sln");
|
root->GetProjectName(), ".sln");
|
||||||
@@ -1099,7 +1099,7 @@ void cmGlobalVisualStudioGenerator::Generate()
|
|||||||
|
|
||||||
// Now write out the VS Solution files.
|
// Now write out the VS Solution files.
|
||||||
for (auto& it : this->ProjectMap) {
|
for (auto& it : this->ProjectMap) {
|
||||||
this->OutputSLNFile(it.second[0], it.second);
|
this->GenerateSolution(it.second[0], it.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any solution or project files changed during the generation,
|
// If any solution or project files changed during the generation,
|
||||||
@@ -1131,8 +1131,9 @@ void cmGlobalVisualStudioGenerator::Generate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalVisualStudioGenerator::OutputSLNFile(
|
void cmGlobalVisualStudioGenerator::GenerateSolution(
|
||||||
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators)
|
cmLocalGenerator const* root,
|
||||||
|
std::vector<cmLocalGenerator*> const& generators)
|
||||||
{
|
{
|
||||||
if (generators.empty()) {
|
if (generators.empty()) {
|
||||||
return;
|
return;
|
||||||
@@ -1149,16 +1150,11 @@ void cmGlobalVisualStudioGenerator::OutputSLNFile(
|
|||||||
if (!fout) {
|
if (!fout) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->WriteSLNFile(fout, root, projectTargets);
|
|
||||||
|
cm::VS::Solution const solution = this->CreateSolution(root, projectTargets);
|
||||||
|
WriteSln(fout, solution);
|
||||||
|
|
||||||
if (fout.Close()) {
|
if (fout.Close()) {
|
||||||
this->FileReplacedDuringGenerate(fname);
|
this->FileReplacedDuringGenerate(fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalVisualStudioGenerator::WriteSLNFile(
|
|
||||||
std::ostream& fout, cmLocalGenerator* root,
|
|
||||||
TargetDependSet const& projectTargets) const
|
|
||||||
{
|
|
||||||
cm::VS::Solution const solution = this->CreateSolution(root, projectTargets);
|
|
||||||
WriteSln(fout, solution);
|
|
||||||
}
|
|
||||||
|
@@ -198,11 +198,8 @@ protected:
|
|||||||
|
|
||||||
void Generate() override;
|
void Generate() override;
|
||||||
|
|
||||||
void OutputSLNFile(cmLocalGenerator* root,
|
void GenerateSolution(cmLocalGenerator const* root,
|
||||||
std::vector<cmLocalGenerator*>& generators);
|
std::vector<cmLocalGenerator*> const& generators);
|
||||||
|
|
||||||
void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
|
|
||||||
TargetDependSet const& projectTargets) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::string GetVSMakeProgram() = 0;
|
virtual std::string GetVSMakeProgram() = 0;
|
||||||
|
Reference in New Issue
Block a user