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

Method Build

Source/cmake.cxx:3855–4130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3853}
3854
3855int cmake::Build(cmBuildArgs buildArgs, std::vector<std::string> targets,
3856 std::vector<std::string> nativeOptions,
3857 cmBuildOptions& buildOptions, std::string const& presetName,
3858 bool listPresets, std::vector<std::string> const& args)
3859{
3860 buildArgs.timeout = cmDuration::zero();
3861
3862#if !defined(CMAKE_BOOTSTRAP)
3863 if (!presetName.empty() || listPresets) {
3864 this->SetHomeDirectory(cmSystemTools::GetLogicalWorkingDirectory());
3865 this->SetHomeOutputDirectory(cmSystemTools::GetLogicalWorkingDirectory());
3866
3867 cmCMakePresetsGraph settingsFile;
3868 auto result = settingsFile.ReadProjectPresets(this->GetHomeDirectory());
3869 if (result != true) {
3870 cmSystemTools::Error(
3871 cmStrCat("Could not read presets from ", this->GetHomeDirectory(),
3872 ":\n", settingsFile.parseState.GetErrorMessage()));
3873 return 1;
3874 }
3875
3876 if (listPresets) {
3877 settingsFile.PrintBuildPresetList();
3878 return 0;
3879 }
3880
3881 auto presetPair = settingsFile.BuildPresets.find(presetName);
3882 if (presetPair == settingsFile.BuildPresets.end()) {
3883 cmSystemTools::Error(cmStrCat("No such build preset in ",
3884 this->GetHomeDirectory(), ": \"",
3885 presetName, '"'));
3886 settingsFile.PrintBuildPresetList();
3887 return 1;
3888 }
3889
3890 if (presetPair->second.Unexpanded.Hidden) {
3891 cmSystemTools::Error(cmStrCat("Cannot use hidden build preset in ",
3892 this->GetHomeDirectory(), ": \"",
3893 presetName, '"'));
3894 settingsFile.PrintBuildPresetList();
3895 return 1;
3896 }
3897
3898 auto const& expandedPreset = presetPair->second.Expanded;
3899 if (!expandedPreset) {
3900 cmSystemTools::Error(cmStrCat("Could not evaluate build preset \"",
3901 presetName,
3902 "\": Invalid macro expansion"));
3903 settingsFile.PrintBuildPresetList();
3904 return 1;
3905 }
3906
3907 if (!expandedPreset->ConditionResult) {
3908 cmSystemTools::Error(cmStrCat("Cannot use disabled build preset in ",
3909 this->GetHomeDirectory(), ": \"",
3910 presetName, '"'));
3911 settingsFile.PrintBuildPresetList();
3912 return 1;

Callers 4

do_buildFunction · 0.45
ResultsLogMethod · 0.45
UseRuleMethod · 0.45
RunMethod · 0.45

Calls 15

SetHomeDirectoryMethod · 0.95
PrintPresetListMethod · 0.95
LoadCacheMethod · 0.95
CreateGlobalGeneratorMethod · 0.95
SetGlobalGeneratorMethod · 0.95
GetGlobalGeneratorMethod · 0.95
GetCurrentSnapshotMethod · 0.95
AddScriptingCommandsMethod · 0.95
AddProjectCommandsMethod · 0.95

Tested by 1

RunMethod · 0.36