summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-18 18:41:46 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-18 18:41:46 (GMT)
commit55a71ba572c54dbb3485a76e9615c1c8bf688fd4 (patch)
treeac692b4ef198284cf7c0e9b65ab854f93e7f865a /Source/cmMakefile.cxx
parentaf61b685839fae6af72ba4c4d42ebf39a7d1a324 (diff)
downloadCMake-55a71ba572c54dbb3485a76e9615c1c8bf688fd4.zip
CMake-55a71ba572c54dbb3485a76e9615c1c8bf688fd4.tar.gz
CMake-55a71ba572c54dbb3485a76e9615c1c8bf688fd4.tar.bz2
ENH: Add check for infinite loops. Make sure that files written using WRITE_FILE and FILE WRITE are not used as input files. Fixes Bug #678 - WRITE_FILE and FILE(WRITE...) lead to infinite loops
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4f287f6..59b270a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2357,5 +2357,26 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
return 1;
}
+void cmMakefile::AddWrittenFile(const char* file)
+{ this->GetCMakeInstance()->AddWrittenFile(file); }
+bool cmMakefile::HasWrittenFile(const char* file)
+{ return this->GetCMakeInstance()->HasWrittenFile(file); }
+bool cmMakefile::CheckInfiniteLoops()
+{
+ std::vector<std::string>::iterator it;
+ for ( it = m_ListFiles.begin();
+ it != m_ListFiles.end();
+ ++ it )
+ {
+ if ( this->HasWrittenFile(it->c_str()) )
+ {
+ cmOStringStream str;
+ str << "File " << it->c_str() << " is written by WRITE_FILE (or FILE WRITE) command and should not be used as input to CMake. Please use CONFIGURE_FILE to be safe. Refer to the note next to FILE WRITE command.";
+ cmSystemTools::Error(str.str().c_str());
+ return false;
+ }
+ }
+ return true;
+}