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

Method GenerateBuildCommand

Source/cmGlobalVisualStudio7Generator.cxx:178–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178std::vector<cmGlobalGenerator::GeneratedMakeCommand>
179cmGlobalVisualStudio7Generator::GenerateBuildCommand(
180 std::string const& makeProgram, std::string const& projectName,
181 std::string const& projectDir, std::vector<std::string> const& targetNames,
182 std::string const& config, int /*jobs*/, bool /*verbose*/,
183 cmBuildOptions /*buildOptions*/, std::vector<std::string> const& makeOptions,
184 BuildTryCompile /*isInTryCompile*/)
185{
186 // Select the caller- or user-preferred make program, else devenv.
187 std::string makeProgramSelected =
188 this->SelectMakeProgram(makeProgram, this->GetDevEnvCommand());
189
190 std::string const slnFile = this->GetSLNFile(projectDir, projectName);
191
192 // Ignore the above preference if it is msbuild.
193 // Assume any other value is either a devenv or
194 // command-line compatible with devenv.
195 std::string makeProgramLower = makeProgramSelected;
196 cmSystemTools::LowerCase(makeProgramLower);
197 if (makeProgramLower.find("msbuild") != std::string::npos) {
198 makeProgramSelected = this->GetDevEnvCommand();
199 }
200
201 // Workaround to convince VCExpress.exe to produce output.
202 bool const requiresOutputForward =
203 (makeProgramLower.find("vcexpress") != std::string::npos);
204 std::vector<GeneratedMakeCommand> makeCommands;
205
206 std::vector<std::string> realTargetNames = targetNames;
207 if (targetNames.empty() ||
208 ((targetNames.size() == 1) && targetNames.front().empty())) {
209 realTargetNames = { "ALL_BUILD" };
210 }
211 for (auto const& tname : realTargetNames) {
212 std::string realTarget;
213 if (!tname.empty()) {
214 realTarget = tname;
215 } else {
216 continue;
217 }
218 bool clean = false;
219 if (realTarget == "clean"_s) {
220 clean = true;
221 realTarget = "ALL_BUILD";
222 }
223 GeneratedMakeCommand makeCommand;
224 makeCommand.RequiresOutputForward = requiresOutputForward;
225 makeCommand.Add(makeProgramSelected);
226 makeCommand.Add(slnFile);
227 makeCommand.Add((clean ? "/clean" : "/build"));
228 makeCommand.Add((config.empty() ? "Debug" : config));
229 makeCommand.Add("/project");
230 makeCommand.Add(realTarget);
231 makeCommand.Add(makeOptions.begin(), makeOptions.end());
232 makeCommands.emplace_back(std::move(makeCommand));
233 }
234 return makeCommands;
235}

Callers

nothing calls this directly

Calls 11

moveFunction · 0.85
SelectMakeProgramMethod · 0.80
GetSLNFileMethod · 0.80
emplace_backMethod · 0.80
findMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
frontMethod · 0.45
AddMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected