diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-07-06 14:42:01 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-07-06 15:40:08 (GMT) |
commit | 9480ced81a861ec34afbcb018ed5feec9152fbe9 (patch) | |
tree | bc6a237c011269b31a93a79e86836a5d1eb5ab7d | |
parent | ad2e7f3c537dc88ea8140bab67c43d25695637f1 (diff) | |
download | CMake-9480ced81a861ec34afbcb018ed5feec9152fbe9.zip CMake-9480ced81a861ec34afbcb018ed5feec9152fbe9.tar.gz CMake-9480ced81a861ec34afbcb018ed5feec9152fbe9.tar.bz2 |
Makefiles generator: dependencies messages in verbose mode
Fixes: #23689
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 37 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/cmake_depends-stdout.txt | 2 |
3 files changed, 26 insertions, 17 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e125470..de1d3cd 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1412,13 +1412,16 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( if (needRescanDependInfo || needRescanDirInfo || needRescanDependencies) { // The dependencies must be regenerated. - std::string targetName = cmSystemTools::GetFilenameName(targetDir); - targetName = targetName.substr(0, targetName.length() - 4); - std::string message = - cmStrCat("Scanning dependencies of target ", targetName); - cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | - cmsysTerminal_Color_ForegroundBold, - message.c_str(), true, color); + if (verbose) { + std::string targetName = cmSystemTools::GetFilenameName(targetDir); + targetName = targetName.substr(0, targetName.length() - 4); + std::string message = + cmStrCat("Scanning dependencies of target ", targetName); + cmSystemTools::MakefileColorEcho( + cmsysTerminal_Color_ForegroundMagenta | + cmsysTerminal_Color_ForegroundBold, + message.c_str(), true, color); + } status = this->ScanDependencies(targetDir, dependFile, internalDependFile, validDependencies); @@ -1447,13 +1450,19 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( this->GetBinaryDirectory()) : std::function<bool(const std::string&)>())) { // regenerate dependencies files - std::string targetName = - cmCMakePath(targetDir).GetFileName().RemoveExtension().GenericString(); - auto message = cmStrCat( - "Consolidate compiler generated dependencies of target ", targetName); - cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | - cmsysTerminal_Color_ForegroundBold, - message.c_str(), true, color); + if (verbose) { + std::string targetName = cmCMakePath(targetDir) + .GetFileName() + .RemoveExtension() + .GenericString(); + auto message = + 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 // because the make tool may try to reload it needlessly otherwise. diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index c8234ec..80a7c69 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -940,8 +940,8 @@ set(CMAKE_DEPENDS_CHECK_C set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\") set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") ") - run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends - "Unix Makefiles" + run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E env VERBOSE=1 + ${CMAKE_COMMAND} -E cmake_depends "Unix Makefiles" ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt index 8fe092b..cf972a8 100644 --- a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt +++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt @@ -1 +1 @@ -^Scanning dependencies of target DepTarget$ +Scanning dependencies of target DepTarget$ |