Browse Source

BUG: Remove check for files written by file(WRITE) being loaded.

  - CMake 1.8 and below did not do the check but could get in
    infinite loops due to the local generate step.
  - CMake 2.0 added the check but failed to perform it in directories
    with no targets (see bug #678).
  - CMake 2.2 removed the local generate which fixed the problem but
    did not remove the check.
  - Between CMake 2.4 and 2.6.0rc6 the check was fixed to work even
    when no targets appear in a directory (see bug #6923).
  - Bottom line: the check is no longer needed.
Brad King 17 years ago
parent
commit
1381aab4b7

+ 0 - 1
Source/cmFileCommand.cxx

@@ -213,7 +213,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
   file << message;
   file.close();
   cmSystemTools::SetPermissions(fileName.c_str(), mode);
-  this->Makefile->AddWrittenFile(fileName.c_str());
   return true;
 }
 

+ 0 - 4
Source/cmFileCommand.h

@@ -90,10 +90,6 @@ public:
       "if it does not exist.\n"
       "APPEND will write a message into a file same as WRITE, except "
       "it will append it to the end of the file\n"
-      "NOTE: When using file WRITE and file APPEND, the produced file "
-      "cannot be used as an input to CMake (configure_file, source file ...) "
-      "because it will lead to an infinite loop. Use configure_file if you "
-      "want to generate input files to CMake.\n"
       "READ will read the content of a file and store it into the "
       "variable. It will start at the given offset and read up to numBytes. "
       "If the argument HEX is given, the binary data will be converted to "

+ 0 - 1
Source/cmGlobalGenerator.cxx

@@ -912,7 +912,6 @@ void cmGlobalGenerator::CheckLocalGenerators()
       }
     this->CMakeInstance->UpdateProgress
       ("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size());
-    this->LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops();
     }
 
   if(notFoundMap.size())

+ 0 - 27
Source/cmMakefile.cxx

@@ -2796,33 +2796,6 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
   return res;
 }
 
-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 = this->ListFiles.begin();
-        it != this->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;
-}
-
 void cmMakefile::SetProperty(const char* prop, const char* value)
 {
   if (!prop)

+ 0 - 12
Source/cmMakefile.h

@@ -93,18 +93,6 @@ public:
     { this->FunctionBlockers.remove(fb);}
   void RemoveFunctionBlocker(const cmListFileFunction& lff);
 
-  /**
-   * Add file to the written file list. These file should not be in the list
-   * of dependencies because they cause infinite loops.
-   */
-  void AddWrittenFile(const char* file);
-  bool HasWrittenFile(const char* file);
-
-  /**
-   * Check if there are any infinite loops
-   */
-  bool CheckInfiniteLoops();
-  
   /**
    * Try running cmake and building a file. This is used for dynalically
    * loaded commands, not as part of the usual build process.

+ 0 - 1
Source/cmWriteFileCommand.cxx

@@ -97,7 +97,6 @@ bool cmWriteFileCommand
   file << message << std::endl;
   file.close();
   cmSystemTools::SetPermissions(fileName.c_str(), mode);
-  this->Makefile->AddWrittenFile(fileName.c_str());
 
   return true;
 }

+ 0 - 17
Source/cmake.cxx

@@ -2081,8 +2081,6 @@ int cmake::ActualConfigure()
     this->GlobalGenerator->ClearEnabledLanguages();
     }
 
-  this->CleanupWrittenFiles();
-
   // Truncate log files
   if (!this->InTryCompile)
     {
@@ -2533,21 +2531,6 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
     }
 }
 
-void cmake::AddWrittenFile(const char* file)
-{
-  this->WrittenFiles.insert(file);
-}
-
-bool cmake::HasWrittenFile(const char* file)
-{
-  return this->WrittenFiles.find(file) != this->WrittenFiles.end();
-}
-
-void cmake::CleanupWrittenFiles()
-{
-  this->WrittenFiles.clear();
-}
-
 void cmake::UpdateConversionPathTable()
 {
   // Update the path conversion table with any specified file:

+ 0 - 6
Source/cmake.h

@@ -294,11 +294,6 @@ class cmake
   bool GetDebugTryCompile(){return this->DebugTryCompile;}
   void DebugTryCompileOn(){this->DebugTryCompile = true;}
 
-  ///! Get the list of files written by CMake using FILE(WRITE / WRITE_FILE
-  void AddWrittenFile(const char* file);
-  bool HasWrittenFile(const char* file);
-  void CleanupWrittenFiles();
-
   /**
    * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries
    */
@@ -389,7 +384,6 @@ protected:
   std::string StartOutputDirectory;
   bool SuppressDevWarnings;
   bool DoSuppressDevWarnings;
-  std::set<cmStdString> WrittenFiles;
 
   ///! return true if the same cmake was used to make the cache.
   bool CacheVersionMatches();