Makefiles generator: dependencies messages in verbose mode

Fixes: #23689
This commit is contained in:
Marc Chevrier 2022-07-06 16:42:01 +02:00
parent ad2e7f3c53
commit 9480ced81a
3 changed files with 26 additions and 17 deletions

View File

@ -1412,13 +1412,16 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
if (needRescanDependInfo || needRescanDirInfo || needRescanDependencies) { if (needRescanDependInfo || needRescanDirInfo || needRescanDependencies) {
// The dependencies must be regenerated. // The dependencies must be regenerated.
std::string targetName = cmSystemTools::GetFilenameName(targetDir); if (verbose) {
targetName = targetName.substr(0, targetName.length() - 4); std::string targetName = cmSystemTools::GetFilenameName(targetDir);
std::string message = targetName = targetName.substr(0, targetName.length() - 4);
cmStrCat("Scanning dependencies of target ", targetName); std::string message =
cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | cmStrCat("Scanning dependencies of target ", targetName);
cmsysTerminal_Color_ForegroundBold, cmSystemTools::MakefileColorEcho(
message.c_str(), true, color); cmsysTerminal_Color_ForegroundMagenta |
cmsysTerminal_Color_ForegroundBold,
message.c_str(), true, color);
}
status = this->ScanDependencies(targetDir, dependFile, status = this->ScanDependencies(targetDir, dependFile,
internalDependFile, validDependencies); internalDependFile, validDependencies);
@ -1447,13 +1450,19 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
this->GetBinaryDirectory()) this->GetBinaryDirectory())
: std::function<bool(const std::string&)>())) { : std::function<bool(const std::string&)>())) {
// regenerate dependencies files // regenerate dependencies files
std::string targetName = if (verbose) {
cmCMakePath(targetDir).GetFileName().RemoveExtension().GenericString(); std::string targetName = cmCMakePath(targetDir)
auto message = cmStrCat( .GetFileName()
"Consolidate compiler generated dependencies of target ", targetName); .RemoveExtension()
cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | .GenericString();
cmsysTerminal_Color_ForegroundBold, auto message =
message.c_str(), true, color); cmStrCat("Consolidate compiler generated dependencies of target ",
targetName);
cmSystemTools::MakefileColorEcho(
cmsysTerminal_Color_ForegroundMagenta |
cmsysTerminal_Color_ForegroundBold,
message.c_str(), true, color);
}
// Open the make depends file. This should be copy-if-different // Open the make depends file. This should be copy-if-different
// because the make tool may try to reload it needlessly otherwise. // because the make tool may try to reload it needlessly otherwise.

View File

@ -940,8 +940,8 @@ set(CMAKE_DEPENDS_CHECK_C
set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\") set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\")
set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\")
") ")
run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E env VERBOSE=1
"Unix Makefiles" ${CMAKE_COMMAND} -E cmake_depends "Unix Makefiles"
${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR}
${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}
${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake

View File

@ -1 +1 @@
^Scanning dependencies of target DepTarget$ Scanning dependencies of target DepTarget$