From 1d3984780df87c6963b0aae1c392a570c890161b Mon Sep 17 00:00:00 2001 From: Michael Ensslin Date: Fri, 10 Jul 2015 18:14:47 +0200 Subject: Makefile: Optionally disable target completion messages in build output Add a TARGET_MESSAGES property to control whether Makefile targets print the "Built target " completion messages. Default to ON to preserve existing behavior. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_gbl/TARGET_MESSAGES.rst | 20 ++++++++++++++++++++ Help/release/dev/makefile-target-messages.rst | 6 ++++++ Modules/CMakeGenericSystem.cmake | 3 +++ Source/cmGlobalUnixMakefileGenerator3.cxx | 16 ++++++++++++++-- 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Help/prop_gbl/TARGET_MESSAGES.rst create mode 100644 Help/release/dev/makefile-target-messages.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index b767ed6..671d893 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -40,6 +40,7 @@ Properties of Global Scope /prop_gbl/RULE_LAUNCH_LINK /prop_gbl/RULE_MESSAGES /prop_gbl/TARGET_ARCHIVES_MAY_BE_SHARED_LIBS + /prop_gbl/TARGET_MESSAGES /prop_gbl/TARGET_SUPPORTS_SHARED_LIBS /prop_gbl/USE_FOLDERS diff --git a/Help/prop_gbl/TARGET_MESSAGES.rst b/Help/prop_gbl/TARGET_MESSAGES.rst new file mode 100644 index 0000000..275b074 --- /dev/null +++ b/Help/prop_gbl/TARGET_MESSAGES.rst @@ -0,0 +1,20 @@ +TARGET_MESSAGES +--------------- + +Specify whether to report the completion of each target. + +This property specifies whether :ref:`Makefile Generators` should +add a progress message describing that each target has been completed. +If the property is not set the default is ``ON``. Set the property +to ``OFF`` to disable target completion messages. + +This option is intended to reduce build output when little or no +work needs to be done to bring the build tree up to date. + +If a ``CMAKE_TARGET_MESSAGES`` cache entry exists its value +initializes the value of this property. + +Non-Makefile generators currently ignore this property. + +See the counterpart property :prop_gbl:`RULE_MESSAGES` to disable +everything except for target completion messages. diff --git a/Help/release/dev/makefile-target-messages.rst b/Help/release/dev/makefile-target-messages.rst new file mode 100644 index 0000000..3d2cd9b --- /dev/null +++ b/Help/release/dev/makefile-target-messages.rst @@ -0,0 +1,6 @@ +makefile-target-messages +------------------------ + +* A :prop_gbl:`TARGET_MESSAGES` global property was added to tell the + :ref:`Makefile Generators` whether to generate commands to print output + after each target is completed. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 730e780..5ae757d 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -52,6 +52,9 @@ if(CMAKE_GENERATOR MATCHES "Make") if(DEFINED CMAKE_RULE_MESSAGES) set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES}) endif() + if(DEFINED CMAKE_TARGET_MESSAGES) + set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES}) + endif() if(CMAKE_GENERATOR MATCHES "Unix Makefiles") set(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL "Enable/Disable output of compile commands during generation." diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c5fca91..edf2705 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -801,8 +801,20 @@ cmGlobalUnixMakefileGenerator3 } progress.Arg = progressArg.str(); } - lg->AppendEcho(commands, "Built target " + name, - cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + + bool targetMessages = true; + if (const char* tgtMsg = this->GetCMakeInstance() + ->GetState() + ->GetGlobalProperty("TARGET_MESSAGES")) + { + targetMessages = cmSystemTools::IsOn(tgtMsg); + } + + if (targetMessages) + { + lg->AppendEcho(commands, "Built target " + name, + cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + } this->AppendGlobalTargetDepends(depends, gtarget); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", -- cgit v0.12