ENH: added support for forcing recomputation of depends
This commit is contained in:
parent
e1870805b4
commit
e559aa11ac
|
@ -418,6 +418,22 @@ void cmGlobalUnixMakefileGenerator3
|
|||
commands.push_back(lg->GetRecursiveMakeCall("Makefile2","clean"));
|
||||
lg->WriteMakeRule(makefileStream, "The main clean target", "clean",
|
||||
depends, commands);
|
||||
|
||||
// write the depend rule, really a recompute depends rule
|
||||
depends.clear();
|
||||
commands.clear();
|
||||
std::string cmakefileName = "Makefile.cmake";
|
||||
std::string runRule =
|
||||
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
|
||||
runRule += " --check-build-system ";
|
||||
runRule += lg->Convert(cmakefileName.c_str(),cmLocalGenerator::NONE,
|
||||
cmLocalGenerator::SHELL);
|
||||
runRule += " 1";
|
||||
|
||||
commands.push_back(runRule);
|
||||
lg->WriteMakeRule(makefileStream, "clear depends",
|
||||
"depend",
|
||||
depends, commands);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -135,7 +135,9 @@ public:
|
|||
std::string ConvertToOutputForExisting(const char* p);
|
||||
|
||||
/** Called from command-line hook to check dependencies. */
|
||||
virtual void CheckDependencies(cmMakefile* /* mf */, bool /* verbose */) {};
|
||||
virtual void CheckDependencies(cmMakefile* /* mf */,
|
||||
bool /* verbose */,
|
||||
bool /* clear */) {};
|
||||
|
||||
/** Called from command-line hook to scan dependencies. */
|
||||
virtual bool ScanDependencies(std::vector<std::string> const& /* args */) {return true;};
|
||||
|
|
|
@ -1164,6 +1164,7 @@ cmLocalUnixMakefileGenerator3
|
|||
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
|
||||
runRule += " --check-build-system ";
|
||||
runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL);
|
||||
runRule += " 0";
|
||||
|
||||
std::vector<std::string> no_depends;
|
||||
std::vector<std::string> commands;
|
||||
|
@ -2883,7 +2884,8 @@ void cmLocalUnixMakefileGenerator3
|
|||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf,
|
||||
bool verbose)
|
||||
bool verbose,
|
||||
bool clear)
|
||||
{
|
||||
// Get the list of languages that may have sources to check.
|
||||
const char* langDef = mf->GetDefinition("CMAKE_DEPENDS_LANGUAGES");
|
||||
|
@ -2913,12 +2915,19 @@ void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf,
|
|||
std::auto_ptr<cmDepends>
|
||||
checker(this->GetDependsChecker(*l, ".", f->c_str(), verbose));
|
||||
if(checker.get())
|
||||
{
|
||||
if (clear)
|
||||
{
|
||||
checker->Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
checker->Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -128,7 +128,8 @@ public:
|
|||
virtual bool ScanDependencies(std::vector<std::string> const& args);
|
||||
|
||||
/** Called from command-line hook to check dependencies. */
|
||||
virtual void CheckDependencies(cmMakefile* mf, bool verbose);
|
||||
virtual void CheckDependencies(cmMakefile* mf, bool verbose,
|
||||
bool clear);
|
||||
|
||||
/** write some extra rules suahc as make test etc */
|
||||
void WriteSpecialTargetsTop(std::ostream& makefileStream);
|
||||
|
|
|
@ -92,6 +92,8 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
|
|||
cmake::cmake()
|
||||
{
|
||||
m_DebugTryCompile = false;
|
||||
m_ClearBuildSystem = false;
|
||||
|
||||
#ifdef __APPLE__
|
||||
struct rlimit rlp;
|
||||
if(!getrlimit(RLIMIT_STACK, &rlp))
|
||||
|
@ -304,6 +306,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
|
|||
else if((i < args.size()-1) && (arg.find("--check-build-system",0) == 0))
|
||||
{
|
||||
m_CheckBuildSystem = args[++i];
|
||||
m_ClearBuildSystem = (atoi(args[++i].c_str()) > 0);
|
||||
}
|
||||
else if(arg.find("-V",0) == 0)
|
||||
{
|
||||
|
@ -1637,7 +1640,7 @@ int cmake::CheckBuildSystem()
|
|||
{
|
||||
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
|
||||
lgd->SetGlobalGenerator(ggd);
|
||||
lgd->CheckDependencies(mf, verbose);
|
||||
lgd->CheckDependencies(mf, verbose, m_ClearBuildSystem);
|
||||
}
|
||||
|
||||
// No need to rerun.
|
||||
|
|
|
@ -303,6 +303,7 @@ private:
|
|||
std::string m_CXXEnvironment;
|
||||
std::string m_CCEnvironment;
|
||||
std::string m_CheckBuildSystem;
|
||||
bool m_ClearBuildSystem;
|
||||
bool m_DebugTryCompile;
|
||||
|
||||
void UpdateConversionPathTable();
|
||||
|
|
Loading…
Reference in New Issue