ENH: Allow projects to disable per-rule echo lines
This creates global property RULE_MESSAGES which can be set to disbale per-rule progress and action reporting. On Windows, these reports may cause a noticable delay due to the cost of starting extra processes. This feature will allow scripted builds to avoid the cost since they do not need detailed information anyway. This replaces the RULE_PROGRESS property created earlier as it is more complete. See issue #8726.
This commit is contained in:
parent
49dec94f54
commit
493f88ce55
|
@ -33,9 +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)
|
||||
IF(DEFINED CMAKE_RULE_MESSAGES)
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES})
|
||||
ENDIF(DEFINED CMAKE_RULE_MESSAGES)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
|
||||
# Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX
|
||||
|
|
|
@ -189,13 +189,16 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||
return;
|
||||
}
|
||||
|
||||
// Add the link message.
|
||||
std::string buildEcho = "Linking ";
|
||||
buildEcho += linkLanguage;
|
||||
buildEcho += " executable ";
|
||||
buildEcho += targetOutPath;
|
||||
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoLink);
|
||||
if(!this->NoRuleMessages)
|
||||
{
|
||||
// Add the link message.
|
||||
std::string buildEcho = "Linking ";
|
||||
buildEcho += linkLanguage;
|
||||
buildEcho += " executable ";
|
||||
buildEcho += targetOutPath;
|
||||
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoLink);
|
||||
}
|
||||
|
||||
// Build a list of compiler flags and linker flags.
|
||||
std::string flags;
|
||||
|
|
|
@ -448,27 +448,30 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
this->Convert(targetFullPathImport.c_str(),cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::SHELL);
|
||||
|
||||
// Add the link message.
|
||||
std::string buildEcho = "Linking ";
|
||||
buildEcho += linkLanguage;
|
||||
switch(this->Target->GetType())
|
||||
if(!this->NoRuleMessages)
|
||||
{
|
||||
case cmTarget::STATIC_LIBRARY:
|
||||
buildEcho += " static library ";
|
||||
break;
|
||||
case cmTarget::SHARED_LIBRARY:
|
||||
buildEcho += " shared library ";
|
||||
break;
|
||||
case cmTarget::MODULE_LIBRARY:
|
||||
buildEcho += " shared module ";
|
||||
break;
|
||||
default:
|
||||
buildEcho += " library ";
|
||||
break;
|
||||
// Add the link message.
|
||||
std::string buildEcho = "Linking ";
|
||||
buildEcho += linkLanguage;
|
||||
switch(this->Target->GetType())
|
||||
{
|
||||
case cmTarget::STATIC_LIBRARY:
|
||||
buildEcho += " static library ";
|
||||
break;
|
||||
case cmTarget::SHARED_LIBRARY:
|
||||
buildEcho += " shared library ";
|
||||
break;
|
||||
case cmTarget::MODULE_LIBRARY:
|
||||
buildEcho += " shared module ";
|
||||
break;
|
||||
default:
|
||||
buildEcho += " library ";
|
||||
break;
|
||||
}
|
||||
buildEcho += targetOutPath.c_str();
|
||||
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoLink);
|
||||
}
|
||||
buildEcho += targetOutPath.c_str();
|
||||
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoLink);
|
||||
|
||||
const char* forbiddenFlagVar = 0;
|
||||
switch(this->Target->GetType())
|
||||
|
|
|
@ -47,10 +47,10 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target)
|
|||
static_cast<cmGlobalUnixMakefileGenerator3*>(
|
||||
this->LocalGenerator->GetGlobalGenerator());
|
||||
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
|
||||
this->NoRuleProgress = false;
|
||||
if(const char* ruleProgress = cm->GetProperty("RULE_PROGRESS"))
|
||||
this->NoRuleMessages = false;
|
||||
if(const char* ruleStatus = cm->GetProperty("RULE_MESSAGES"))
|
||||
{
|
||||
this->NoRuleProgress = cmSystemTools::IsOff(ruleProgress);
|
||||
this->NoRuleMessages = cmSystemTools::IsOff(ruleStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
|||
cmLocalGenerator::MAKEFILE)
|
||||
<< "\n\n";
|
||||
|
||||
if(!this->NoRuleProgress)
|
||||
if(!this->NoRuleMessages)
|
||||
{
|
||||
// Include the progress variables for the target.
|
||||
*this->BuildFileStream
|
||||
|
@ -591,12 +591,15 @@ cmMakefileTargetGenerator
|
|||
// add in a progress call if needed
|
||||
this->AppendProgress(commands);
|
||||
|
||||
std::string buildEcho = "Building ";
|
||||
buildEcho += lang;
|
||||
buildEcho += " object ";
|
||||
buildEcho += relativeObj;
|
||||
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoBuild);
|
||||
if(!this->NoRuleMessages)
|
||||
{
|
||||
std::string buildEcho = "Building ";
|
||||
buildEcho += lang;
|
||||
buildEcho += " object ";
|
||||
buildEcho += relativeObj;
|
||||
this->LocalGenerator->AppendEcho
|
||||
(commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
|
||||
}
|
||||
|
||||
std::string targetOutPathPDB;
|
||||
{
|
||||
|
@ -1106,9 +1109,12 @@ void cmMakefileTargetGenerator
|
|||
{
|
||||
// add in a progress call if needed
|
||||
this->AppendProgress(commands);
|
||||
this->LocalGenerator
|
||||
->AppendEcho(commands, comment.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoGenerate);
|
||||
if(!this->NoRuleMessages)
|
||||
{
|
||||
this->LocalGenerator
|
||||
->AppendEcho(commands, comment.c_str(),
|
||||
cmLocalUnixMakefileGenerator3::EchoGenerate);
|
||||
}
|
||||
}
|
||||
|
||||
// Now append the actual user-specified commands.
|
||||
|
@ -1209,7 +1215,7 @@ void
|
|||
cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
|
||||
{
|
||||
this->NumberOfProgressActions++;
|
||||
if(this->NoRuleProgress)
|
||||
if(this->NoRuleMessages)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ protected:
|
|||
std::string ProgressFileName;
|
||||
std::string ProgressFileNameFull;
|
||||
unsigned long NumberOfProgressActions;
|
||||
bool NoRuleProgress;
|
||||
bool NoRuleMessages;
|
||||
|
||||
// the path to the directory the build file is in
|
||||
std::string TargetBuildDirectory;
|
||||
|
|
|
@ -3455,16 +3455,16 @@ void cmake::DefineProperties(cmake *cm)
|
|||
"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. "
|
||||
("RULE_MESSAGES", cmProperty::GLOBAL,
|
||||
"Specify whether to report a message for each make rule.",
|
||||
"This property specifies whether Makefile generators should add a "
|
||||
"progress message describing what each build rule does. "
|
||||
"If the property is not set the default is ON. "
|
||||
"Set the property to OFF to disable granular progress and report only "
|
||||
"Set the property to OFF to disable granular messages 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 "
|
||||
"cost of detailed reports. "
|
||||
"If a CMAKE_RULE_MESSAGES cache entry exists its value initializes "
|
||||
"the value of this property. "
|
||||
"Non-Makefile generators currently ignore this property.");
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ 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)
|
||||
# Test building without per-rule echo lines in Makefiles.
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||
|
||||
# Choose whether to test CMakeLib.
|
||||
SET(COMPLEX_TEST_CMAKELIB 1)
|
||||
|
|
|
@ -14,8 +14,8 @@ 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)
|
||||
# Test building without per-rule echo lines in Makefiles.
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||
|
||||
# Choose whether to test CMakeLib.
|
||||
SET(COMPLEX_TEST_CMAKELIB 1)
|
||||
|
|
|
@ -14,8 +14,8 @@ 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)
|
||||
# Test building without per-rule echo lines in Makefiles.
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||
|
||||
# Choose whether to test CMakeLib.
|
||||
SET(COMPLEX_TEST_CMAKELIB 1)
|
||||
|
|
Loading…
Reference in New Issue