===== Motivation: In my project, openage, the build system currently produces fairly much useless output, even if not a single file of the project has changed:
mic@mic ~/git/openage $ make [ 0%] Built target compilepy [ 1%] Built target cythonize [ 1%] Built target codegen [ 83%] Built target libopenage [ 84%] Built target openage_testing_cpp_testing [ 86%] Built target run [ 87%] Built target openage_cabextract_cabchecksum [ 88%] Built target openage_cabextract_lzxd [ 89%] Built target openage_cppinterface_exctranslate [ 90%] Built target openage_cppinterface_exctranslate_tests [ 91%] Built target openage_cppinterface_setup_checker [ 93%] Built target openage_cppinterface_pyobject [ 94%] Built target openage_game_main_cpp [ 95%] Built target openage_log_log_cpp [ 96%] Built target openage_util_fslike_cpp [ 98%] Built target openage_testing_misc_cpp [ 99%] Built target inplacemodules [ 99%] Built target pxdgen [100%] Built target distfiles mic@mic ~/git/openage $ That list of targets is expected to grow fairly large in the near-distant future; at some point, it might even get large enough to hide actual important compilation messages. ===== Patch: The patch adds a global property, "TARGET_MESSAGES", which behaves analogous to "RULE_MESSAGES" in that it can be explicitly set to OFF to suppress some build output. When set to OFF, the above invocation of `make` will produce no output. Otherwise, CMake will behave as usual. The patch includes some documentation. ~ Michael Ensslin
From 4f7d9f93b976ff594666fc1f3c19836839f97f8b Mon Sep 17 00:00:00 2001 From: Michael Ensslin <[email protected]> Date: Fri, 10 Jul 2015 18:14:47 +0200 Subject: [PATCH] Added the TARGET_MESSAGES property Controls whether Makefile targets print the "Built target " completion messages. Defaults to ON. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_gbl/TARGET_MESSAGES.rst | 22 ++++++++++++++++++++++ Modules/CMakeGenericSystem.cmake | 3 +++ Source/cmGlobalUnixMakefileGenerator3.cxx | 15 +++++++++++++-- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Help/prop_gbl/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..23aa148 --- /dev/null +++ b/Help/prop_gbl/TARGET_MESSAGES.rst @@ -0,0 +1,22 @@ +TARGET_MESSAGES +--------------- + +Specify whether to report the completion of each target. + +This property specifies whether 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 is intended to make continuous builds less spammy; if only +one source file has changed, the build output will only involve +messages related to that file, not completion messages for all +other targets. + +If a CMAKE_TARGET_MESSAGES cache entry exists its value initializes +the value of this property. + +Non-Makefile generators currently ignore this property. + +Also see its counterpart property, RULE_MESSAGES, which may be used +to disable everything except for target completion messages. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 8a14aea..f209eb2 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -52,6 +52,9 @@ if(CMAKE_GENERATOR MATCHES "Makefiles") 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..77561b2 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -801,8 +801,19 @@ cmGlobalUnixMakefileGenerator3 } progress.Arg = progressArg.str(); } - lg->AppendEcho(commands, "Built target " + name, - cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + + bool TargetMessages = true; + if(const char* ruleStatus = this->GetCMakeInstance() + ->GetState() + ->GetGlobalProperty("TARGET_MESSAGES")) + { + TargetMessages = cmSystemTools::IsOn(ruleStatus); + } + + if (TargetMessages) { + lg->AppendEcho(commands, "Built target " + name, + cmLocalUnixMakefileGenerator3::EchoNormal, &progress); + } this->AppendGlobalTargetDepends(depends, gtarget); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", -- 2.1.4
signature.asc
Description: OpenPGP digital signature
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
