MCPcopy Create free account
hub / github.com/Kitware/CMake / SetGeneratorToolset

Method SetGeneratorToolset

Source/cmGlobalVisualStudio10Generator.cxx:102–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
103 std::string const& ts, bool build, cmMakefile* mf)
104{
105 if (this->SystemIsWindowsCE && ts.empty() &&
106 this->DefaultPlatformToolset.empty()) {
107 mf->IssueMessage(
108 MessageType::FATAL_ERROR,
109 cmStrCat(this->GetName(), " Windows CE version '", this->SystemVersion,
110 "' requires CMAKE_GENERATOR_TOOLSET to be set."));
111 return false;
112 }
113
114 if (!this->ParseGeneratorToolset(ts, mf)) {
115 return false;
116 }
117
118 if (build) {
119 return true;
120 }
121
122 if (this->CustomVCTargetsPath.empty() && !this->FindVCTargetsPath(mf)) {
123 return false;
124 }
125
126 if (!this->CustomFlagTableDir.empty() &&
127 !(cmSystemTools::FileIsFullPath(this->CustomFlagTableDir) &&
128 cmSystemTools::FileIsDirectory(this->CustomFlagTableDir))) {
129 mf->IssueMessage(
130 MessageType::FATAL_ERROR,
131 cmStrCat("Generator\n"
132 " ",
133 this->GetName(),
134 "\n"
135 "given toolset\n"
136 " customFlagTableDir=",
137 this->CustomFlagTableDir,
138 "\n"
139 "that is not an absolute path to an existing directory."));
140 cmSystemTools::SetFatalErrorOccurred();
141 return false;
142 }
143
144 if (cmHasLiteralPrefix(this->GetPlatformToolsetString(), "v140")) {
145 // The GenerateDebugInformation link setting for the v140 toolset
146 // in VS 2015 was originally an enum with "No" and "Debug" values,
147 // differing from the "false" and "true" values used in older toolsets.
148 // A VS 2015 update changed it back. Parse the "link.xml" file to
149 // discover which one we need.
150 std::string const link_xml =
151 cmStrCat(this->VCTargetsPath, "/1033/link.xml");
152 cmsys::ifstream fin(link_xml.c_str());
153 std::string line;
154 while (fin && cmSystemTools::GetLineFromStream(fin, line)) {
155 if (line.find(" Switch=\"DEBUG\" ") != std::string::npos) {
156 this->PlatformToolsetNeedsDebugEnum =
157 line.find(" Name=\"Debug\" ") != std::string::npos;
158 break;
159 }

Callers

nothing calls this directly

Calls 15

ParseGeneratorToolsetMethod · 0.95
FindVCTargetsPathMethod · 0.95
FindAuxToolsetMethod · 0.95
GetPlatformToolsetMethod · 0.95
cmHasLiteralPrefixFunction · 0.85
moveFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected