[Cmake-commits] [cmake-commits] king committed cmFileCommand.cxx 1.106 1.107 cmFileCommand.h 1.36 1.37 cmGlobalGenerator.cxx 1.227 1.228 cmMakefile.cxx 1.468 1.469 cmMakefile.h 1.231 1.232 cmWriteFileCommand.cxx 1.16 1.17 cmake.cxx 1.382 1.383 cmake.h 1.113 1.114

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Apr 30 13:42:43 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv20164/Source

Modified Files:
	cmFileCommand.cxx cmFileCommand.h cmGlobalGenerator.cxx 
	cmMakefile.cxx cmMakefile.h cmWriteFileCommand.cxx cmake.cxx 
	cmake.h 
Log Message:
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.


Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.113
retrieving revision 1.114
diff -C 2 -d -r1.113 -r1.114
*** cmake.h	2 Apr 2008 21:29:25 -0000	1.113
--- cmake.h	30 Apr 2008 17:42:40 -0000	1.114
***************
*** 295,303 ****
    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
--- 295,298 ----
***************
*** 390,394 ****
    bool SuppressDevWarnings;
    bool DoSuppressDevWarnings;
-   std::set<cmStdString> WrittenFiles;
  
    ///! return true if the same cmake was used to make the cache.
--- 385,388 ----

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.227
retrieving revision 1.228
diff -C 2 -d -r1.227 -r1.228
*** cmGlobalGenerator.cxx	4 Mar 2008 23:41:52 -0000	1.227
--- cmGlobalGenerator.cxx	30 Apr 2008 17:42:38 -0000	1.228
***************
*** 913,917 ****
      this->CMakeInstance->UpdateProgress
        ("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size());
-     this->LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops();
      }
  
--- 913,916 ----

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.382
retrieving revision 1.383
diff -C 2 -d -r1.382 -r1.383
*** cmake.cxx	4 Apr 2008 20:02:50 -0000	1.382
--- cmake.cxx	30 Apr 2008 17:42:40 -0000	1.383
***************
*** 2082,2087 ****
      }
  
-   this->CleanupWrittenFiles();
- 
    // Truncate log files
    if (!this->InTryCompile)
--- 2082,2085 ----
***************
*** 2534,2552 ****
  }
  
- 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()
  {
--- 2532,2535 ----

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.231
retrieving revision 1.232
diff -C 2 -d -r1.231 -r1.232
*** cmMakefile.h	31 Mar 2008 17:33:09 -0000	1.231
--- cmMakefile.h	30 Apr 2008 17:42:39 -0000	1.232
***************
*** 95,110 ****
  
    /**
-    * 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.
--- 95,98 ----

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.106
retrieving revision 1.107
diff -C 2 -d -r1.106 -r1.107
*** cmFileCommand.cxx	14 Apr 2008 19:02:44 -0000	1.106
--- cmFileCommand.cxx	30 Apr 2008 17:42:37 -0000	1.107
***************
*** 214,218 ****
    file.close();
    cmSystemTools::SetPermissions(fileName.c_str(), mode);
-   this->Makefile->AddWrittenFile(fileName.c_str());
    return true;
  }
--- 214,217 ----

Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C 2 -d -r1.36 -r1.37
*** cmFileCommand.h	14 Apr 2008 19:02:44 -0000	1.36
--- cmFileCommand.h	30 Apr 2008 17:42:38 -0000	1.37
***************
*** 91,98 ****
        "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. "
--- 91,94 ----

Index: cmWriteFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmWriteFileCommand.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -C 2 -d -r1.16 -r1.17
*** cmWriteFileCommand.cxx	23 Jan 2008 15:27:59 -0000	1.16
--- cmWriteFileCommand.cxx	30 Apr 2008 17:42:39 -0000	1.17
***************
*** 98,102 ****
    file.close();
    cmSystemTools::SetPermissions(fileName.c_str(), mode);
-   this->Makefile->AddWrittenFile(fileName.c_str());
  
    return true;
--- 98,101 ----

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.468
retrieving revision 1.469
diff -C 2 -d -r1.468 -r1.469
*** cmMakefile.cxx	30 Apr 2008 17:26:04 -0000	1.468
--- cmMakefile.cxx	30 Apr 2008 17:42:39 -0000	1.469
***************
*** 2797,2827 ****
  }
  
- 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)
  {
--- 2797,2800 ----



More information about the Cmake-commits mailing list