summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx62
1 files changed, 62 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 8106e7e..d8f35f1 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -19,6 +19,51 @@
#include "cmMakefile.h"
#include "cmVisualStudio10TargetGenerator.h"
#include "cmGlobalVisualStudio7Generator.h"
+#include <cm_expat.h>
+#include "cmXMLParser.h"
+class cmVS10XMLParser : public cmXMLParser
+{
+ public:
+ virtual void EndElement(const char* /* name */)
+ {
+ }
+ virtual void CharacterDataHandler(const char* data, int length)
+ {
+ if(this->DoGUID )
+ {
+ this->GUID.assign(data, length);
+ this->DoGUID = false;
+ }
+ }
+ virtual void StartElement(const char* name, const char**)
+ {
+ // once the GUID is found do nothing
+ if(this->GUID.size())
+ {
+ return;
+ }
+ if(strcmp("ProjectGUID", name) == 0)
+ {
+ this->DoGUID = true;
+ }
+ }
+ int InitializeParser()
+ {
+ this->DoGUID = false;
+ int ret = cmXMLParser::InitializeParser();
+ if(ret == 0)
+ {
+ return ret;
+ }
+ // visual studio projects have a strange encoding, but it is
+ // really utf-8
+ XML_SetEncoding(static_cast<XML_Parser>(this->Parser), "utf-8");
+ return 1;
+ }
+ std::string GUID;
+ bool DoGUID;
+};
+
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
@@ -62,3 +107,20 @@ void cmLocalVisualStudio10Generator::Generate()
this->WriteStampFiles();
}
+
+void cmLocalVisualStudio10Generator
+::ReadAndStoreExternalGUID(const char* name,
+ const char* path)
+{
+
+ cmVS10XMLParser parser;
+ parser.ParseFile(path);
+ std::string guidStoreName = name;
+ guidStoreName += "_GUID_CMAKE";
+ // save the GUID in the cache
+ this->GlobalGenerator->GetCMakeInstance()->
+ AddCacheEntry(guidStoreName.c_str(),
+ parser.GUID.c_str(),
+ "Stored GUID",
+ cmCacheManager::INTERNAL);
+}