diff options
author | Brad King <brad.king@kitware.com> | 2024-12-11 15:09:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-12-11 15:10:02 (GMT) |
commit | 4671919cbb8e1b44a412f1bb018434287e9989f8 (patch) | |
tree | ebb49bebb2bdec82a2e6ea8916f93fd55ae4d9bc /Source | |
parent | f5c5b39ce8124a07f95133053225b412bc95d01c (diff) | |
parent | 25b43a5b7fdc6216278f45fc6e7e65e0f50ed3b2 (diff) | |
download | CMake-4671919cbb8e1b44a412f1bb018434287e9989f8.zip CMake-4671919cbb8e1b44a412f1bb018434287e9989f8.tar.gz CMake-4671919cbb8e1b44a412f1bb018434287e9989f8.tar.bz2 |
Merge topic 'codegen-make' into release-3.31
25b43a5b7f Makefile: Enable progress messages for codegen target
af2b340a2e Makefile: Fix per-directory codegen target
b7e6c418e3 cmLocalUnixMakefileGenerator3: Simplify progress command generation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10085
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 44 |
2 files changed, 22 insertions, 26 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 38cc4f6..32c2a20 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -777,6 +777,10 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( makeTargetName = cmStrCat(localName, "/codegen"); commands.push_back( lg.GetRecursiveMakeCall(makefileName, makeTargetName)); + if (targetMessages) { + lg.AppendEcho(commands, "Finished codegen for target " + name, + cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + } this->AppendCodegenTargetDepends(depends, gtarget.get()); rootLG.WriteMakeRule(ruleFileStream, "codegen rule for target.", makeTargetName, depends, commands, true); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4a776b4..1e58f0b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -6,7 +6,6 @@ #include <cassert> #include <cstdio> #include <functional> -#include <sstream> #include <utility> #include <cm/memory> @@ -1733,33 +1732,24 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( depends.emplace_back("cmake_check_build_system"); } - std::string progressDir = - cmStrCat(this->GetBinaryDirectory(), "/CMakeFiles"); - { - std::ostringstream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; - progCmd << this->ConvertToOutputFormat(progressDir, - cmOutputConverter::SHELL); - - std::string progressFile = "/CMakeFiles/progress.marks"; - std::string progressFileNameFull = this->ConvertToFullPath(progressFile); - progCmd << " " - << this->ConvertToOutputFormat(progressFileNameFull, - cmOutputConverter::SHELL); - commands.push_back(progCmd.str()); - } + std::string const progressDir = this->ConvertToOutputFormat( + cmStrCat(this->GetBinaryDirectory(), "/CMakeFiles"), + cmOutputConverter::SHELL); + std::string const progressMarks = this->ConvertToOutputFormat( + this->ConvertToFullPath("/CMakeFiles/progress.marks"), + cmOutputConverter::SHELL); + std::string const progressStartCommand = + cmStrCat("$(CMAKE_COMMAND) -E cmake_progress_start ", progressDir, ' ', + progressMarks); + std::string const progressFinishCommand = + cmStrCat("$(CMAKE_COMMAND) -E cmake_progress_start ", progressDir, " 0"); + + commands.emplace_back(progressStartCommand); std::string mf2Dir = "CMakeFiles/Makefile2"; commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); - { - std::ostringstream progCmd; - progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << this->ConvertToOutputFormat(progressDir, - cmOutputConverter::SHELL); - progCmd << " 0"; - commands.push_back(progCmd.str()); - } + commands.emplace_back(progressFinishCommand); this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands, true); @@ -1771,9 +1761,11 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( if (regenerate) { depends.emplace_back("cmake_check_build_system"); } + commands.emplace_back(progressStartCommand); commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget)); - AppendEcho(commands, "Finished generating code", - cmLocalUnixMakefileGenerator3::EchoColor::EchoGenerate); + this->CreateCDCommand(commands, this->GetBinaryDirectory(), + this->GetCurrentBinaryDirectory()); + commands.emplace_back(progressFinishCommand); this->WriteMakeRule(ruleFileStream, "The main codegen target", "codegen", depends, commands, true); } |