diff options
author | Brad King <brad.king@kitware.com> | 2017-07-10 20:37:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-07-11 14:41:28 (GMT) |
commit | 5cf9c3d0cc654ba1a84f8bd65edbd09945c909a4 (patch) | |
tree | 036212ad96d3bbe65a6590e640a0dacd70e3f1a7 /Source/cmGlobalVisualStudio7Generator.cxx | |
parent | 372de3f8039f69b3a2edcf7120083ec4097f8bd3 (diff) | |
download | CMake-5cf9c3d0cc654ba1a84f8bd65edbd09945c909a4.zip CMake-5cf9c3d0cc654ba1a84f8bd65edbd09945c909a4.tar.gz CMake-5cf9c3d0cc654ba1a84f8bd65edbd09945c909a4.tar.bz2 |
VS: Add SolutionGuid to generated .sln files
Visual Studio 2017 Update 3 adds a SolutionGuid to its `.sln` files.
Fixes: #17041
Diffstat (limited to 'Source/cmGlobalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index f067d8f..b155f5b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -520,6 +520,7 @@ std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath( void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( std::ostream& fout, cmLocalGenerator* root) { + std::string const guid = this->GetGUID(root->GetProjectName() + ".sln"); bool extensibilityGlobalsOverridden = false; bool extensibilityAddInsOverridden = false; const std::vector<std::string> propKeys = @@ -538,11 +539,14 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( } else continue; if (!name.empty()) { - if (name == "ExtensibilityGlobals" && sectionType == "postSolution") + bool addGuid = false; + if (name == "ExtensibilityGlobals" && sectionType == "postSolution") { + addGuid = true; extensibilityGlobalsOverridden = true; - else if (name == "ExtensibilityAddIns" && - sectionType == "postSolution") + } else if (name == "ExtensibilityAddIns" && + sectionType == "postSolution") { extensibilityAddInsOverridden = true; + } fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; std::vector<std::string> keyValuePairs; cmSystemTools::ExpandListArgument( @@ -557,15 +561,23 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( const std::string value = cmSystemTools::TrimWhitespace(itPair->substr(posEqual + 1)); fout << "\t\t" << key << " = " << value << "\n"; + if (key == "SolutionGuid") { + addGuid = false; + } } } + if (addGuid) { + fout << "\t\tSolutionGuid = {" << guid << "}\n"; + } fout << "\tEndGlobalSection\n"; } } } - if (!extensibilityGlobalsOverridden) + if (!extensibilityGlobalsOverridden) { fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n" + << "\t\tSolutionGuid = {" << guid << "}\n" << "\tEndGlobalSection\n"; + } if (!extensibilityAddInsOverridden) fout << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n" << "\tEndGlobalSection\n"; |