diff options
author | Brad King <brad.king@kitware.com> | 2009-03-16 20:22:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-03-16 20:22:19 (GMT) |
commit | 2f651c2e59d4b4fcb46ac6ad293332db99f430f3 (patch) | |
tree | 54474c321bc5ff0381ad70bc419a2e3e8bc41ac1 | |
parent | 741ae600c411f9226b5e44dfd7319741987d5181 (diff) | |
download | CMake-2f651c2e59d4b4fcb46ac6ad293332db99f430f3.zip CMake-2f651c2e59d4b4fcb46ac6ad293332db99f430f3.tar.gz CMake-2f651c2e59d4b4fcb46ac6ad293332db99f430f3.tar.bz2 |
ENH: Allow projects to disable per-rule progress
This creates global property RULE_PROGRESS which can be set to disbale
per-rule progress reporting. On Windows, progress reports may cause a
noticable delay due to the cost of starting an extra process. This
feature will allow scripted builds to avoid the cost since they do not
need detailed progress anyway. See issue #8726.
-rw-r--r-- | Modules/CMakeGenericSystem.cmake | 3 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 31 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmake.cxx | 14 | ||||
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/CMakeLists.txt | 3 |
7 files changed, 49 insertions, 9 deletions
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 2599f2b..7271114 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -33,6 +33,9 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") "Enable/Disable color output during build." ) MARK_AS_ADVANCED(CMAKE_COLOR_MAKEFILE) + IF(DEFINED CMAKE_RULE_PROGRESS) + SET_PROPERTY(GLOBAL PROPERTY RULE_PROGRESS ${CMAKE_RULE_PROGRESS}) + ENDIF(DEFINED CMAKE_RULE_PROGRESS) ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") # Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b8b9141..b88abed 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -46,6 +46,12 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) this->GlobalGenerator = static_cast<cmGlobalUnixMakefileGenerator3*>( this->LocalGenerator->GetGlobalGenerator()); + cmake* cm = this->GlobalGenerator->GetCMakeInstance(); + this->NoRuleProgress = false; + if(const char* ruleProgress = cm->GetProperty("RULE_PROGRESS")) + { + this->NoRuleProgress = cmSystemTools::IsOff(ruleProgress); + } } cmMakefileTargetGenerator * @@ -195,15 +201,18 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; - - // Include the progress variables for the target. - *this->BuildFileStream - << "# Include the progress variables for this target.\n" - << this->LocalGenerator->IncludeDirective << " " - << this->Convert(this->ProgressFileNameFull.c_str(), - cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::MAKEFILE) - << "\n\n"; + + if(!this->NoRuleProgress) + { + // Include the progress variables for the target. + *this->BuildFileStream + << "# Include the progress variables for this target.\n" + << this->LocalGenerator->IncludeDirective << " " + << this->Convert(this->ProgressFileNameFull.c_str(), + cmLocalGenerator::HOME_OUTPUT, + cmLocalGenerator::MAKEFILE) + << "\n\n"; + } // make sure the depend file exists if (!cmSystemTools::FileExists(dependFileNameFull.c_str())) @@ -1200,6 +1209,10 @@ void cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands) { this->NumberOfProgressActions++; + if(this->NoRuleProgress) + { + return; + } std::string progressDir = this->Makefile->GetHomeOutputDirectory(); progressDir += cmake::GetCMakeFilesDirectory(); cmOStringStream progCmd; diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index f743240..629d192 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -170,6 +170,7 @@ protected: std::string ProgressFileName; std::string ProgressFileNameFull; unsigned long NumberOfProgressActions; + bool NoRuleProgress; // the path to the directory the build file is in std::string TargetBuildDirectory; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5cabc22..33265a3 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3454,6 +3454,20 @@ void cmake::DefineProperties(cmake *cm) "with high granularity. " "Non-Makefile generators currently ignore this property."); + cm->DefineProperty + ("RULE_PROGRESS", cmProperty::GLOBAL, + "Specify whether to report progress for each make rule.", + "Makefile generators add commands to report progress. " + "This property specifies whether to report progress on every rule. " + "If the property is not set the default is ON. " + "Set the property to OFF to disable granular progress and report only " + "as each target completes. " + "This is intended to allow scripted builds to avoid the build time " + "cost of detailed progress reports. " + "If a CMAKE_RULE_PROGRESS cache entry exists its value initializes " + "the value of this property. " + "Non-Makefile generators currently ignore this property."); + // ================================================================ // define variables as well // ================================================================ diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index b2ed25c..569ca30 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -14,6 +14,9 @@ IF(POLICY CMP0003) ENDIF(NOT "${P3}" STREQUAL "NEW") ENDIF(POLICY CMP0003) +# Test building without per-rule progress in Makefiles. +SET_PROPERTY(GLOBAL PROPERTY RULE_PROGRESS OFF) + # Choose whether to test CMakeLib. SET(COMPLEX_TEST_CMAKELIB 1) IF(CMAKE_TEST_DIFFERENT_GENERATOR) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index b2ed25c..569ca30 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -14,6 +14,9 @@ IF(POLICY CMP0003) ENDIF(NOT "${P3}" STREQUAL "NEW") ENDIF(POLICY CMP0003) +# Test building without per-rule progress in Makefiles. +SET_PROPERTY(GLOBAL PROPERTY RULE_PROGRESS OFF) + # Choose whether to test CMakeLib. SET(COMPLEX_TEST_CMAKELIB 1) IF(CMAKE_TEST_DIFFERENT_GENERATOR) diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index b2ed25c..569ca30 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -14,6 +14,9 @@ IF(POLICY CMP0003) ENDIF(NOT "${P3}" STREQUAL "NEW") ENDIF(POLICY CMP0003) +# Test building without per-rule progress in Makefiles. +SET_PROPERTY(GLOBAL PROPERTY RULE_PROGRESS OFF) + # Choose whether to test CMakeLib. SET(COMPLEX_TEST_CMAKELIB 1) IF(CMAKE_TEST_DIFFERENT_GENERATOR) |