diff options
author | Florian Schweiger <husker@dzdm.de> | 2022-02-02 18:23:35 +0100 |
---|---|---|
committer | Florian Schweiger <husker@dzdm.de> | 2022-02-07 13:08:37 +0100 |
commit | 5cdd774d519d7a524c398855573781dfdbf41a02 (patch) | |
tree | cc727ea79d59d35c4743722e6353311af3d8720a /Source/cmVisualStudioSlnParser.cxx | |
parent | 309191052cf83bc5535ff66e9ece04cda18d5fe5 (diff) | |
download | cmake-5cdd774d519d7a524c398855573781dfdbf41a02.tar.gz |
VS: Handle build target correct for .NET SDK style projects with Any CPU
* Extend Visual Studio solution parser for reading build target
* Map solution build target to project build target (especially for Any CPU)
* Use C++ <optional> template instead of pointer return value for cmSlnData::GetProjectByGUID
Diffstat (limited to 'Source/cmVisualStudioSlnParser.cxx')
-rw-r--r-- | Source/cmVisualStudioSlnParser.cxx | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx index 8138f4c86d..feab895d41 100644 --- a/Source/cmVisualStudioSlnParser.cxx +++ b/Source/cmVisualStudioSlnParser.cxx @@ -11,6 +11,7 @@ #include "cmsys/FStream.hxx" #include "cmStringAlgorithms.h" +#include "cmSystemTools.h" #include "cmVisualStudioSlnData.h" namespace { @@ -294,10 +295,9 @@ bool cmVisualStudioSlnParser::State::Process( case FileStateSolutionConfigurations: if (line.GetTag().compare("EndGlobalSection") == 0) this->Stack.pop(); - else if (line.IsKeyValuePair()) - // implement configuration storing here, once needed - ; - else { + else if (line.IsKeyValuePair()) { + output.AddConfiguration(line.GetValue(0)); + } else { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); return false; } @@ -305,10 +305,30 @@ bool cmVisualStudioSlnParser::State::Process( case FileStateProjectConfigurations: if (line.GetTag().compare("EndGlobalSection") == 0) this->Stack.pop(); - else if (line.IsKeyValuePair()) - // implement configuration storing here, once needed - ; - else { + else if (line.IsKeyValuePair()) { + std::vector<std::string> tagElements = + cmSystemTools::SplitString(line.GetTag(), '.'); + if (tagElements.size() != 3 && tagElements.size() != 4) { + result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); + return false; + } + + std::string guid = tagElements[0]; + std::string solutionConfiguration = tagElements[1]; + std::string activeBuild = tagElements[2]; + cm::optional<cmSlnProjectEntry> projectEntry = + output.GetProjectByGUID(guid); + + if (!projectEntry) { + result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); + return false; + } + + if (activeBuild.compare("ActiveCfg") == 0) { + projectEntry->AddProjectConfiguration(solutionConfiguration, + line.GetValue(0)); + } + } else { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); return false; } @@ -459,8 +479,7 @@ bool cmVisualStudioSlnParser::GetParseHadBOM() const bool cmVisualStudioSlnParser::IsDataGroupSetSupported( DataGroupSet dataGroups) const { - return (dataGroups & DataGroupProjects) == dataGroups; - // only supporting DataGroupProjects for now + return (dataGroups & DataGroupProjects) != 0; } bool cmVisualStudioSlnParser::ParseImpl(std::istream& input, cmSlnData& output, |