summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-07-13 20:58:24 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-07-13 20:58:24 (GMT)
commit11d42b3e8f17c2b99838045545ae82df54a80b98 (patch)
treee246736fdb03f8c0dd3cff46e1067aa81b103a72 /Source/cmLocalVisualStudio10Generator.cxx
parent724275b26651b06ac5757a68ec8b25a430f5fdc8 (diff)
downloadCMake-11d42b3e8f17c2b99838045545ae82df54a80b98.zip
CMake-11d42b3e8f17c2b99838045545ae82df54a80b98.tar.gz
CMake-11d42b3e8f17c2b99838045545ae82df54a80b98.tar.bz2
ENH: almost all tests passing in vs 10, commit fixes preprocess and starts vs external project
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);
+}