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

Method GenerateBuildCommand

Source/cmGlobalFastbuildGenerator.cxx:348–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348std::vector<cmGlobalGenerator::GeneratedMakeCommand>
349cmGlobalFastbuildGenerator::GenerateBuildCommand(
350 std::string const& makeProgram, std::string const& /*projectName*/,
351 std::string const& projectDir, std::vector<std::string> const& targetNames,
352 std::string const& /*config*/, int /*jobs*/, bool verbose,
353 cmBuildOptions /*buildOptions*/, std::vector<std::string> const& makeOptions,
354 BuildTryCompile isInTryCompile)
355{
356 GeneratedMakeCommand makeCommand;
357 this->FastbuildCommand = this->SelectMakeProgram(makeProgram);
358 makeCommand.Add(this->FastbuildCommand);
359 // A build command for fastbuild looks like this:
360 // fbuild.exe [make-options] [-config projectName.bff] <target>
361
362 std::string configFile = cmStrCat(projectDir, '/', FASTBUILD_BUILD_FILE);
363
364 // Push in the make options
365 makeCommand.Add(makeOptions.begin(), makeOptions.end());
366
367 if (!configFile.empty()) {
368 makeCommand.Add("-config", configFile);
369 }
370 // Tested in "RunCMake.SymlinkTrees" test.
371 makeCommand.Add("-continueafterdbmove");
372
373 // Tested in RunCMake.LinkWhatYouUse on Linux. (We need to see output of
374 // LinkerStampExe process).
375 // In general, it might be useful to see output of external processes
376 // regardless of their outcome.
377 makeCommand.Add("-showcmdoutput");
378
379 // Add the target-config to the command
380 for (auto const& tname : targetNames) {
381 if (!tname.empty()) {
382 makeCommand.Add(tname);
383 }
384 }
385 if (verbose) {
386 makeCommand.Add("-verbose");
387 }
388
389 // Don't do extra work during "TryCompile".
390 if (isInTryCompile == BuildTryCompile::Yes) {
391 return { std::move(makeCommand) };
392 }
393
394 // Make "rebuild-bff" target up-to-date before running the build.
395 std::string output;
396 ExecuteFastbuildTarget(projectDir, FASTBUILD_REBUILD_BFF_TARGET_NAME, output,
397 { "-why" });
398
399 // If fbuild.bff was re-generated we need to "restat" it.
400 if (output.find("Need to build") != std::string::npos) {
401 // Let the user know that re-generation happened (and why it
402 // happened).
403 cmSystemTools::Stdout(output);
404 // FASTBuild will consider the target out-of-date in case some of the
405 // inputs have changes after re-generation which might happen if, for

Callers

nothing calls this directly

Calls 8

moveFunction · 0.85
SelectMakeProgramMethod · 0.80
cmStrCatFunction · 0.70
AddMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected