mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
cmGlobalVisualStudio7Generator: Constify .sln write methods
This commit is contained in:
@@ -568,7 +568,7 @@ void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root,
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio14Generator::WriteFolderSolutionItems(
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder)
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) const
|
||||
{
|
||||
fout << "\tProjectSection(SolutionItems) = preProject\n";
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ protected:
|
||||
|
||||
void AddSolutionItems(cmLocalGenerator* root, VSFolders& vsFolders) override;
|
||||
|
||||
void WriteFolderSolutionItems(std::ostream& fout,
|
||||
cmVisualStudioFolder const& folder) override;
|
||||
void WriteFolderSolutionItems(
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) const override;
|
||||
|
||||
private:
|
||||
class Factory;
|
||||
|
||||
@@ -26,7 +26,7 @@ cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(cmake* cm)
|
||||
void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& orderedProjectTargets,
|
||||
VSFolders const& vsFolders)
|
||||
VSFolders const& vsFolders) const
|
||||
{
|
||||
std::vector<std::string> configs =
|
||||
root->GetMakefile()->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
@@ -67,7 +67,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs)
|
||||
std::ostream& fout, std::vector<std::string> const& configs) const
|
||||
{
|
||||
fout << "\tGlobalSection(SolutionConfiguration) = preSolution\n";
|
||||
for (std::string const& i : configs) {
|
||||
@@ -79,10 +79,9 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations(
|
||||
// Write a dsp file into the SLN file,
|
||||
// Note, that dependencies from executables to
|
||||
// the libraries it uses are also done here
|
||||
void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
||||
std::string const& dspname,
|
||||
std::string const& dir,
|
||||
cmGeneratorTarget const* t)
|
||||
void cmGlobalVisualStudio71Generator::WriteProject(
|
||||
std::ostream& fout, std::string const& dspname, std::string const& dir,
|
||||
cmGeneratorTarget const* t) const
|
||||
{
|
||||
// check to see if this is a fortran build
|
||||
std::string ext = ".vcproj";
|
||||
@@ -133,9 +132,11 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
||||
// the libraries it uses are also done here
|
||||
void cmGlobalVisualStudio71Generator::WriteProjectDepends(
|
||||
std::ostream& fout, std::string const&, std::string const&,
|
||||
cmGeneratorTarget const* target)
|
||||
cmGeneratorTarget const* target) const
|
||||
{
|
||||
VSDependSet const& depends = this->VSTargetDepends[target];
|
||||
auto i = this->VSTargetDepends.find(target);
|
||||
assert(i != this->VSTargetDepends.end());
|
||||
VSDependSet const& depends = i->second;
|
||||
for (std::string const& name : depends) {
|
||||
std::string guid = this->GetGUID(name);
|
||||
if (guid.empty()) {
|
||||
@@ -151,7 +152,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(
|
||||
// executables to the libraries it uses are also done here
|
||||
void cmGlobalVisualStudio71Generator::WriteExternalProject(
|
||||
std::ostream& fout, std::string const& name, std::string const& location,
|
||||
cmValue typeGuid, std::set<BT<std::pair<std::string, bool>>> const& depends)
|
||||
cmValue typeGuid,
|
||||
std::set<BT<std::pair<std::string, bool>>> const& depends) const
|
||||
{
|
||||
fout << "Project(\"{"
|
||||
<< (typeGuid ? *typeGuid
|
||||
@@ -185,7 +187,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name, cmGeneratorTarget const& target,
|
||||
std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping)
|
||||
std::string const& platformMapping) const
|
||||
{
|
||||
std::string const& platformName =
|
||||
!platformMapping.empty() ? platformMapping : this->GetPlatformName();
|
||||
|
||||
@@ -30,24 +30,24 @@ public:
|
||||
protected:
|
||||
void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& orderedProjectTargets,
|
||||
VSFolders const& vsFolders) override;
|
||||
VSFolders const& vsFolders) const override;
|
||||
virtual void WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs);
|
||||
std::ostream& fout, std::vector<std::string> const& configs) const;
|
||||
void WriteProject(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) override;
|
||||
cmGeneratorTarget const* t) const override;
|
||||
void WriteProjectDepends(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) override;
|
||||
cmGeneratorTarget const* t) const override;
|
||||
void WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name,
|
||||
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping = "") override;
|
||||
std::string const& platformMapping = "") const override;
|
||||
void WriteExternalProject(
|
||||
std::ostream& fout, std::string const& name, std::string const& path,
|
||||
cmValue typeGuid,
|
||||
std::set<BT<std::pair<std::string, bool>>> const& depends) override;
|
||||
std::set<BT<std::pair<std::string, bool>>> const& depends) const override;
|
||||
|
||||
// Folders are not supported by VS 7.1.
|
||||
bool UseFolderProperty() const override { return false; }
|
||||
|
||||
@@ -350,7 +350,7 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile()
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets)
|
||||
OrderedTargetDependSet const& projectTargets) const
|
||||
{
|
||||
// loop over again and write out configurations for each target
|
||||
// in the solution
|
||||
@@ -443,7 +443,7 @@ cmVisualStudioFolder* cmGlobalVisualStudio7Generator::VSFolders::Create(
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& projectTargets)
|
||||
OrderedTargetDependSet const& projectTargets) const
|
||||
{
|
||||
std::vector<std::string> configs =
|
||||
root->GetMakefile()->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
@@ -476,8 +476,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
}
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout,
|
||||
VSFolders const& vsFolders)
|
||||
void cmGlobalVisualStudio7Generator::WriteFolders(
|
||||
std::ostream& fout, VSFolders const& vsFolders) const
|
||||
{
|
||||
cm::string_view const prefix = "CMAKE_FOLDER_GUID_";
|
||||
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
|
||||
@@ -504,7 +504,7 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout,
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteFoldersContent(
|
||||
std::ostream& fout, VSFolders const& vsFolders)
|
||||
std::ostream& fout, VSFolders const& vsFolders) const
|
||||
{
|
||||
for (auto const& iter : vsFolders.Folders) {
|
||||
std::string key(iter.first);
|
||||
@@ -520,7 +520,7 @@ void cmGlobalVisualStudio7Generator::WriteFoldersContent(
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
|
||||
std::string const& path)
|
||||
std::string const& path) const
|
||||
{
|
||||
// Convert to backslashes. Do not use ConvertToOutputPath because
|
||||
// we will add quoting ourselves, and we know these projects always
|
||||
@@ -534,7 +534,7 @@ std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
|
||||
std::ostream& fout, cmLocalGenerator* root)
|
||||
std::ostream& fout, cmLocalGenerator* root) const
|
||||
{
|
||||
std::string const guid =
|
||||
this->GetGUID(cmStrCat(root->GetProjectName(), ".sln"));
|
||||
@@ -600,7 +600,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
|
||||
}
|
||||
|
||||
// Standard end of dsw file
|
||||
void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout)
|
||||
void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout) const
|
||||
{
|
||||
fout << "EndGlobal\n";
|
||||
}
|
||||
@@ -668,7 +668,8 @@ std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend(
|
||||
return pname;
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
|
||||
std::string cmGlobalVisualStudio7Generator::GetGUID(
|
||||
std::string const& name) const
|
||||
{
|
||||
std::string const& guidStoreName = cmStrCat(name, "_GUID_CMAKE");
|
||||
if (cmValue storedGUID =
|
||||
@@ -702,7 +703,7 @@ void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig(
|
||||
std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||
std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* target)
|
||||
cmGeneratorTarget const* target) const
|
||||
{
|
||||
std::set<std::string> activeConfigs;
|
||||
// if it is a utility target then only make it part of the
|
||||
@@ -745,7 +746,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||
}
|
||||
|
||||
bool cmGlobalVisualStudio7Generator::IsDependedOn(
|
||||
OrderedTargetDependSet const& projectTargets, cmGeneratorTarget const* gtIn)
|
||||
OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* gtIn) const
|
||||
{
|
||||
return std::any_of(projectTargets.begin(), projectTargets.end(),
|
||||
[this, gtIn](cmTargetDepend const& l) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
virtual void OutputSLNFile();
|
||||
|
||||
//! Lookup a stored GUID or compute one deterministically.
|
||||
std::string GetGUID(std::string const& name);
|
||||
std::string GetGUID(std::string const& name) const;
|
||||
|
||||
/** Append the subdirectory for the given configuration. */
|
||||
void AppendDirectoryForConfig(std::string const& prefix,
|
||||
@@ -150,21 +150,21 @@ protected:
|
||||
virtual void WriteSLNFile(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& orderedProjectTargets,
|
||||
VSFolders const& vsFolders) = 0;
|
||||
VSFolders const& vsFolders) const = 0;
|
||||
virtual void WriteProject(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) = 0;
|
||||
cmGeneratorTarget const* t) const = 0;
|
||||
virtual void WriteProjectDepends(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) = 0;
|
||||
cmGeneratorTarget const* t) const = 0;
|
||||
virtual void WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name,
|
||||
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping = "") = 0;
|
||||
std::string const& platformMapping = "") const = 0;
|
||||
virtual void WriteSLNGlobalSections(std::ostream& fout,
|
||||
cmLocalGenerator* root);
|
||||
virtual void WriteSLNFooter(std::ostream& fout);
|
||||
cmLocalGenerator* root) const;
|
||||
virtual void WriteSLNFooter(std::ostream& fout) const;
|
||||
std::string WriteUtilityDepend(cmGeneratorTarget const* target) override;
|
||||
|
||||
VSFolders CreateSolutionFolders(
|
||||
@@ -172,34 +172,35 @@ protected:
|
||||
|
||||
virtual void WriteTargetsToSolution(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& projectTargets);
|
||||
OrderedTargetDependSet const& projectTargets) const;
|
||||
virtual void WriteTargetConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets);
|
||||
OrderedTargetDependSet const& projectTargets) const;
|
||||
|
||||
virtual void WriteExternalProject(
|
||||
std::ostream& fout, std::string const& name, std::string const& path,
|
||||
cmValue typeGuid,
|
||||
std::set<BT<std::pair<std::string, bool>>> const& dependencies) = 0;
|
||||
std::set<BT<std::pair<std::string, bool>>> const& dependencies) const = 0;
|
||||
|
||||
std::string ConvertToSolutionPath(std::string const& path);
|
||||
std::string ConvertToSolutionPath(std::string const& path) const;
|
||||
|
||||
std::set<std::string> IsPartOfDefaultBuild(
|
||||
std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* target);
|
||||
cmGeneratorTarget const* target) const;
|
||||
bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* target);
|
||||
cmGeneratorTarget const* target) const;
|
||||
std::map<std::string, std::string> GUIDMap;
|
||||
|
||||
virtual void WriteFolders(std::ostream& fout, VSFolders const& vsFolders);
|
||||
virtual void WriteFolders(std::ostream& fout,
|
||||
VSFolders const& vsFolders) const;
|
||||
virtual void WriteFoldersContent(std::ostream& fout,
|
||||
VSFolders const& vsFolders);
|
||||
VSFolders const& vsFolders) const;
|
||||
|
||||
virtual void AddSolutionItems(cmLocalGenerator* root,
|
||||
VSFolders& vsFolders) = 0;
|
||||
virtual void WriteFolderSolutionItems(
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) = 0;
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) const = 0;
|
||||
|
||||
bool MarmasmEnabled;
|
||||
bool MasmEnabled;
|
||||
|
||||
@@ -363,7 +363,7 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs)
|
||||
std::ostream& fout, std::vector<std::string> const& configs) const
|
||||
{
|
||||
fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
|
||||
for (std::string const& i : configs) {
|
||||
@@ -377,7 +377,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name, cmGeneratorTarget const& target,
|
||||
std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping)
|
||||
std::string const& platformMapping) const
|
||||
{
|
||||
std::string guid = this->GetGUID(name);
|
||||
for (std::string const& i : configs) {
|
||||
@@ -460,7 +460,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
|
||||
|
||||
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
|
||||
std::ostream& fout, std::string const&, std::string const&,
|
||||
cmGeneratorTarget const* gt)
|
||||
cmGeneratorTarget const* gt) const
|
||||
{
|
||||
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
|
||||
OrderedTargetDependSet depends(unordered, std::string());
|
||||
|
||||
@@ -73,16 +73,17 @@ protected:
|
||||
|
||||
static cmIDEFlagTable const* GetExtraFlagTableVS8();
|
||||
void WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs) override;
|
||||
std::ostream& fout,
|
||||
std::vector<std::string> const& configs) const override;
|
||||
void WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name,
|
||||
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping = "") override;
|
||||
std::string const& platformMapping = "") const override;
|
||||
bool ComputeTargetDepends() override;
|
||||
void WriteProjectDepends(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) override;
|
||||
cmGeneratorTarget const* t) const override;
|
||||
|
||||
bool UseFolderProperty() const override;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ char const* cmGlobalVisualStudioGenerator::GetIDEVersion() const
|
||||
return "";
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout)
|
||||
void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) const
|
||||
{
|
||||
char utf8bom[] = { char(0xEF), char(0xBB), char(0xBF) };
|
||||
fout.write(utf8bom, 3);
|
||||
@@ -780,7 +780,7 @@ void RegisterVisualStudioMacros(std::string const& macrosFile,
|
||||
}
|
||||
}
|
||||
bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
|
||||
cmGeneratorTarget const* gt)
|
||||
cmGeneratorTarget const* gt) const
|
||||
{
|
||||
// If there's only one source language, Fortran has to be used
|
||||
// in order for the sources to compile.
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
void CallVisualStudioMacro(MacroName m, std::string const& vsSolutionFile);
|
||||
|
||||
// return true if target is fortran only
|
||||
bool TargetIsFortranOnly(cmGeneratorTarget const* gt);
|
||||
bool TargetIsFortranOnly(cmGeneratorTarget const* gt) const;
|
||||
|
||||
// return true if target should be included in solution.
|
||||
virtual bool IsInSolution(cmGeneratorTarget const* gt) const;
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
|
||||
char const* GetIDEVersion() const;
|
||||
|
||||
void WriteSLNHeader(std::ostream& fout);
|
||||
void WriteSLNHeader(std::ostream& fout) const;
|
||||
|
||||
bool ComputeTargetDepends() override;
|
||||
class VSDependSet : public std::set<std::string>
|
||||
|
||||
Reference in New Issue
Block a user