summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-12-05 19:56:31 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-12-05 19:56:31 (GMT)
commit7985bc118e336010a5b840ca3c326287649a463c (patch)
treeaba922a0b053775debeaf66ce1d13a9c1ea7a727 /Source
parent83f596ee9d7ddba7880ccf1f51c9b6d82d0267ec (diff)
downloadCMake-7985bc118e336010a5b840ca3c326287649a463c.zip
CMake-7985bc118e336010a5b840ca3c326287649a463c.tar.gz
CMake-7985bc118e336010a5b840ca3c326287649a463c.tar.bz2
ENH: add a rule to automatically re-run cmake from the top if the CMakeCache.txt file is changed
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCacheManager.cxx12
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx12
2 files changed, 21 insertions, 3 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 81762a1..8609db3 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -456,8 +456,18 @@ bool cmCacheManager::SaveCache(const char* path)
cmSystemTools::CopyFileIfDifferent(tempFile.c_str(),
cacheFile.c_str());
cmSystemTools::RemoveFile(tempFile.c_str());
- return true;
+ std::string checkCacheFile = path;
+ checkCacheFile += "/cmake.check_cache";
+ std::ofstream checkCache(checkCacheFile.c_str());
+ if(!checkCache)
+ {
+ cmSystemTools::Error("Unable to open check cache file for write. ",
+ checkCacheFile.c_str());
+ return false;
}
+ checkCache << "# This file is generated by cmake for dependency checking of the CMakeCache.txt file\n";
+ return true;
+}
void cmCacheManager::OutputHelpString(std::ofstream& fout,
const std::string& helpString)
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 3c5c7cc..875da65 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -214,13 +214,14 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file,
cacheFile += "/CMakeCache.txt";
fout << " " << cmSystemTools::ConvertToOutputPath(cacheFile.c_str());
fout << "\n\n\n";
- this->OutputMakeVariables(fout);
+ this->OutputMakeVariables(fout);
+
// Set up the default target as the VERY first target, so that make with no arguments will run it
this->
OutputMakeRule(fout,
"Default target executed when no arguments are given to make, first make sure cmake.depends exists, cmake.check_depends is up-to-date, check the sources, then build the all target",
"default_target",
- 0,
+ "$(CMAKE_BINARY_DIR)/cmake.check_cache",
"$(MAKE) $(MAKESILENT) cmake.depends",
"$(MAKE) $(MAKESILENT) cmake.check_depends",
"$(MAKE) $(MAKESILENT) -f cmake.check_depends",
@@ -1568,6 +1569,7 @@ void cmLocalUnixMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout)
{
return;
}
+
this->OutputSubDirectoryVars(fout,
"SUBDIR_BUILD",
"default_target",
@@ -2120,6 +2122,12 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"$(CMAKE_BINARY_DIR)/CMakeCache.txt",
"$(CMAKE_COMMAND) "
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
+ this->OutputMakeRule(fout,
+ "CMakeCache.txt because out-of-date:",
+ "$(CMAKE_BINARY_DIR)/cmake.check_cache",
+ "$(CMAKE_BINARY_DIR)/CMakeCache.txt",
+ "$(CMAKE_COMMAND) "
+ "-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
// if CMAKE_EDIT_COMMAND is defined then add a rule to run it
// called edit_cache
if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))