--project: fixing vcxproj load

This commit is contained in:
Daniel Marjamäki 2016-12-04 19:15:04 +01:00
parent 8b18b6229e
commit 1137c1e6b8
1 changed files with 11 additions and 8 deletions

View File

@ -333,14 +333,22 @@ static std::list<std::string> toStringList(const std::string &s)
return ret; return ret;
} }
static void importPropertyGroup(const tinyxml2::XMLElement *node, std::map<std::string,std::string> *variables, std::string *includePath) static void importPropertyGroup(const tinyxml2::XMLElement *node, std::map<std::string,std::string> *variables, std::string *includePath, bool *useOfMfc)
{ {
if (useOfMfc) {
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
if (std::strcmp(e->Name(), "UseOfMfc") == 0)
*useOfMfc = true;
}
}
if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"),"UserMacros")==0) { if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"),"UserMacros")==0) {
for (const tinyxml2::XMLElement *propertyGroup = node->FirstChildElement(); propertyGroup; propertyGroup = propertyGroup->NextSiblingElement()) { for (const tinyxml2::XMLElement *propertyGroup = node->FirstChildElement(); propertyGroup; propertyGroup = propertyGroup->NextSiblingElement()) {
const std::string name(propertyGroup->Name()); const std::string name(propertyGroup->Name());
const char *text = propertyGroup->GetText(); const char *text = propertyGroup->GetText();
(*variables)[name] = std::string(text ? text : ""); (*variables)[name] = std::string(text ? text : "");
} }
} else if (!node->Attribute("Label")) { } else if (!node->Attribute("Label")) {
for (const tinyxml2::XMLElement *propertyGroup = node->FirstChildElement(); propertyGroup; propertyGroup = propertyGroup->NextSiblingElement()) { for (const tinyxml2::XMLElement *propertyGroup = node->FirstChildElement(); propertyGroup; propertyGroup = propertyGroup->NextSiblingElement()) {
if (std::strcmp(propertyGroup->Name(), "IncludePath") != 0) if (std::strcmp(propertyGroup->Name(), "IncludePath") != 0)
@ -380,7 +388,7 @@ static void loadVisualStudioProperties(const std::string &props, std::map<std::s
} }
} }
} else if (std::strcmp(node->Name(),"PropertyGroup")==0) { } else if (std::strcmp(node->Name(),"PropertyGroup")==0) {
importPropertyGroup(node, variables, includePath); importPropertyGroup(node, variables, includePath, nullptr);
} else if (std::strcmp(node->Name(),"ItemDefinitionGroup")==0) { } else if (std::strcmp(node->Name(),"ItemDefinitionGroup")==0) {
itemDefinitionGroupList.push_back(ItemDefinitionGroup(node, additionalIncludeDirectories)); itemDefinitionGroupList.push_back(ItemDefinitionGroup(node, additionalIncludeDirectories));
} }
@ -421,10 +429,7 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
} else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) { } else if (std::strcmp(node->Name(), "ItemDefinitionGroup") == 0) {
itemDefinitionGroupList.push_back(ItemDefinitionGroup(node, additionalIncludeDirectories)); itemDefinitionGroupList.push_back(ItemDefinitionGroup(node, additionalIncludeDirectories));
} else if (std::strcmp(node->Name(), "PropertyGroup") == 0) { } else if (std::strcmp(node->Name(), "PropertyGroup") == 0) {
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) { importPropertyGroup(node, &variables, &includePath, &useOfMfc);
if (std::strcmp(e->Name(), "UseOfMfc") == 0)
useOfMfc = true;
}
} else if (std::strcmp(node->Name(), "ImportGroup") == 0) { } else if (std::strcmp(node->Name(), "ImportGroup") == 0) {
if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"), "PropertySheets") == 0) { if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"), "PropertySheets") == 0) {
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) { for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
@ -435,8 +440,6 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
} }
} }
} }
} else if (std::strcmp(node->Name(),"PropertyGroup")==0) {
importPropertyGroup(node, &variables, &includePath);
} }
} }