summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-05-26 18:30:18 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-05-27 11:04:17 (GMT)
commit8451a3f0b545347a812288e66d757692c770097d (patch)
tree4f1c53bc98b605052390ecf61aa2af03ce93da34 /Source/cmake.cxx
parente06066653124f4fd8d1f9ca1c3e1cd8a4ceac7f9 (diff)
downloadCMake-8451a3f0b545347a812288e66d757692c770097d.zip
CMake-8451a3f0b545347a812288e66d757692c770097d.tar.gz
CMake-8451a3f0b545347a812288e66d757692c770097d.tar.bz2
cmGlobalGenerator: use a stream for output in `Build`
This allows output to show up in output immediately instead of being batched.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 868728f..12b9b24 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3625,7 +3625,6 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
return 1;
}
}
- std::string output;
std::string projName;
cmValue cachedProjectName =
this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
@@ -3699,18 +3698,16 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
}
this->GlobalGenerator->PrintBuildCommandAdvice(std::cerr, jobs);
+ std::stringstream ostr;
+ // `cmGlobalGenerator::Build` logs metadata about what directory and commands
+ // are being executed to the `output` parameter. If CMake is verbose, print
+ // this out.
+ std::ostream& verbose_ostr = verbose ? std::cout : ostr;
int buildresult = this->GlobalGenerator->Build(
- jobs, "", dir, projName, targets, output, "", config, buildOptions,
+ jobs, "", dir, projName, targets, verbose_ostr, "", config, buildOptions,
verbose, cmDuration::zero(), cmSystemTools::OUTPUT_PASSTHROUGH,
nativeOptions);
- if (verbose) {
- // `cmGlobalGenerator::Build` logs metadata about what directory and
- // commands are being executed to the `output` parameter. If CMake is
- // verbose, print this out.
- std::cout << output;
- }
-
return buildresult;
}