ENH: Added option CMAKE_SKIP_RULE_DEPENDENCY to skip making build rules depend on their own rule files. It can be added to the cache by the user or added by the project in a list file.

This commit is contained in:
Brad King 2005-03-08 13:43:17 -05:00
parent 200c98fc32
commit ddb0408007
2 changed files with 23 additions and 6 deletions

View File

@ -527,7 +527,7 @@ cmLocalUnixMakefileGenerator2
depends.push_back(i->c_str()); depends.push_back(i->c_str());
} }
} }
depends.push_back(ruleFileName); this->AppendRuleDepend(depends, ruleFileName.c_str());
// Write the dependency generation rule. // Write the dependency generation rule.
{ {
@ -723,7 +723,7 @@ cmLocalUnixMakefileGenerator2
this->AppendCustomDepend(depends, cc); this->AppendCustomDepend(depends, cc);
// Add a dependency on the rule file itself. // Add a dependency on the rule file itself.
depends.push_back(ruleFileName); this->AppendRuleDepend(depends, ruleFileName.c_str());
// Write the rule. // Write the rule.
const char* comment = 0; const char* comment = 0;
@ -807,7 +807,7 @@ cmLocalUnixMakefileGenerator2
this->AppendTargetDepends(depends, target); this->AppendTargetDepends(depends, target);
// Add a dependency on the rule file itself. // Add a dependency on the rule file itself.
depends.push_back(ruleFileName); this->AppendRuleDepend(depends, ruleFileName.c_str());
// Write the rule. // Write the rule.
this->WriteMakeRule(ruleFileStream, 0, this->WriteMakeRule(ruleFileStream, 0,
@ -1585,7 +1585,7 @@ cmLocalUnixMakefileGenerator2
this->AppendTargetDepends(depends, target); this->AppendTargetDepends(depends, target);
// Add a dependency on the rule file itself. // Add a dependency on the rule file itself.
depends.push_back(ruleFileName); this->AppendRuleDepend(depends, ruleFileName);
// Construct the full path to the executable that will be generated. // Construct the full path to the executable that will be generated.
std::string targetFullPath = m_ExecutableOutputPath; std::string targetFullPath = m_ExecutableOutputPath;
@ -1850,7 +1850,7 @@ cmLocalUnixMakefileGenerator2
this->AppendTargetDepends(depends, target); this->AppendTargetDepends(depends, target);
// Add a dependency on the rule file itself. // Add a dependency on the rule file itself.
depends.push_back(ruleFileName); this->AppendRuleDepend(depends, ruleFileName);
// Get the language to use for linking this library. // Get the language to use for linking this library.
const char* linkLanguage = const char* linkLanguage =
@ -2073,7 +2073,7 @@ cmLocalUnixMakefileGenerator2
} }
// Depend on the rule file itself. // Depend on the rule file itself.
depends.push_back(ruleFileName); this->AppendRuleDepend(depends, ruleFileName);
// Write the rule. // Write the rule.
this->WriteMakeRule(ruleFileStream, 0, this->WriteMakeRule(ruleFileStream, 0,
@ -2605,6 +2605,21 @@ cmLocalUnixMakefileGenerator2
} }
} }
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator2
::AppendRuleDepend(std::vector<std::string>& depends,
const char* ruleFileName)
{
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
const char* nodep = m_Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY");
if(!nodep || cmSystemTools::IsOff(nodep))
{
depends.push_back(ruleFileName);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmLocalUnixMakefileGenerator2 cmLocalUnixMakefileGenerator2

View File

@ -207,6 +207,8 @@ protected:
void AppendTargetDepends(std::vector<std::string>& depends, void AppendTargetDepends(std::vector<std::string>& depends,
const cmTarget& target); const cmTarget& target);
void AppendAnyDepend(std::vector<std::string>& depends, const char* name); void AppendAnyDepend(std::vector<std::string>& depends, const char* name);
void AppendRuleDepend(std::vector<std::string>& depends,
const char* ruleFileName);
void AppendCustomDepends(std::vector<std::string>& depends, void AppendCustomDepends(std::vector<std::string>& depends,
const std::vector<cmCustomCommand>& ccs); const std::vector<cmCustomCommand>& ccs);
void AppendCustomDepend(std::vector<std::string>& depends, void AppendCustomDepend(std::vector<std::string>& depends,