Output total time when using -j N
[cmake.git] / Source / cmLocalVisualStudio10Generator.cxx
blob93e21d99e262525eb707f6c445cbba8a8f106efc
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmLocalVisualStudio10Generator.cxx,v $
5 Language: C++
6 Date: $Date: 2009-07-14 18:16:46 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmLocalVisualStudio10Generator.h"
18 #include "cmTarget.h"
19 #include "cmMakefile.h"
20 #include "cmVisualStudio10TargetGenerator.h"
21 #include "cmGlobalVisualStudio7Generator.h"
22 #include <cm_expat.h>
23 #include "cmXMLParser.h"
24 class cmVS10XMLParser : public cmXMLParser
26 public:
27 virtual void EndElement(const char* /* name */)
30 virtual void CharacterDataHandler(const char* data, int length)
32 if(this->DoGUID )
34 this->GUID.assign(data+1, length-2);
35 this->DoGUID = false;
38 virtual void StartElement(const char* name, const char**)
40 // once the GUID is found do nothing
41 if(this->GUID.size())
43 return;
45 if(strcmp("ProjectGUID", name) == 0)
47 this->DoGUID = true;
50 int InitializeParser()
52 this->DoGUID = false;
53 int ret = cmXMLParser::InitializeParser();
54 if(ret == 0)
56 return ret;
58 // visual studio projects have a strange encoding, but it is
59 // really utf-8
60 XML_SetEncoding(static_cast<XML_Parser>(this->Parser), "utf-8");
61 return 1;
63 std::string GUID;
64 bool DoGUID;
68 //----------------------------------------------------------------------------
69 cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
71 this->NeedXMLEscape = true;
74 cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
78 void cmLocalVisualStudio10Generator::Generate()
81 cmTargets &tgts = this->Makefile->GetTargets();
82 // Create the regeneration custom rule.
83 if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION"))
85 // Create a rule to regenerate the build system when the target
86 // specification source changes.
87 if(cmSourceFile* sf = this->CreateVCProjBuildRule())
89 // Add the rule to targets that need it.
90 for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
92 if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
94 l->second.AddSourceFile(sf);
100 for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
102 cmVisualStudio10TargetGenerator tg(&l->second,
103 (cmGlobalVisualStudio7Generator*)
104 this->GetGlobalGenerator());
105 tg.Generate();
107 this->WriteStampFiles();
111 void cmLocalVisualStudio10Generator
112 ::ReadAndStoreExternalGUID(const char* name,
113 const char* path)
115 cmVS10XMLParser parser;
116 parser.ParseFile(path);
117 std::string guidStoreName = name;
118 guidStoreName += "_GUID_CMAKE";
119 // save the GUID in the cache
120 this->GlobalGenerator->GetCMakeInstance()->
121 AddCacheEntry(guidStoreName.c_str(),
122 parser.GUID.c_str(),
123 "Stored GUID",
124 cmCacheManager::INTERNAL);