From 1137c1e6b8b8f2d71ed4132c4caffbffe263e6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 4 Dec 2016 19:15:04 +0100 Subject: [PATCH] --project: fixing vcxproj load --- lib/importproject.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 4f3becb14..76358a5e7 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -333,14 +333,22 @@ static std::list toStringList(const std::string &s) return ret; } -static void importPropertyGroup(const tinyxml2::XMLElement *node, std::map *variables, std::string *includePath) +static void importPropertyGroup(const tinyxml2::XMLElement *node, std::map *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) { for (const tinyxml2::XMLElement *propertyGroup = node->FirstChildElement(); propertyGroup; propertyGroup = propertyGroup->NextSiblingElement()) { const std::string name(propertyGroup->Name()); const char *text = propertyGroup->GetText(); (*variables)[name] = std::string(text ? text : ""); } + } else if (!node->Attribute("Label")) { for (const tinyxml2::XMLElement *propertyGroup = node->FirstChildElement(); propertyGroup; propertyGroup = propertyGroup->NextSiblingElement()) { if (std::strcmp(propertyGroup->Name(), "IncludePath") != 0) @@ -380,7 +388,7 @@ static void loadVisualStudioProperties(const std::string &props, std::mapName(),"PropertyGroup")==0) { - importPropertyGroup(node, variables, includePath); + importPropertyGroup(node, variables, includePath, nullptr); } else if (std::strcmp(node->Name(),"ItemDefinitionGroup")==0) { itemDefinitionGroupList.push_back(ItemDefinitionGroup(node, additionalIncludeDirectories)); } @@ -421,10 +429,7 @@ void ImportProject::importVcxproj(const std::string &filename, std::mapName(), "ItemDefinitionGroup") == 0) { itemDefinitionGroupList.push_back(ItemDefinitionGroup(node, additionalIncludeDirectories)); } else if (std::strcmp(node->Name(), "PropertyGroup") == 0) { - for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) { - if (std::strcmp(e->Name(), "UseOfMfc") == 0) - useOfMfc = true; - } + importPropertyGroup(node, &variables, &includePath, &useOfMfc); } else if (std::strcmp(node->Name(), "ImportGroup") == 0) { if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"), "PropertySheets") == 0) { for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) { @@ -435,8 +440,6 @@ void ImportProject::importVcxproj(const std::string &filename, std::mapName(),"PropertyGroup")==0) { - importPropertyGroup(node, &variables, &includePath); } }