[Cmake-commits] [cmake-commits] hoffman committed cmFileCommand.h 1.35.2.4 1.35.2.5 cmFindPackageCommand.cxx 1.36.2.5 1.36.2.6 cmFindPackageCommand.h 1.19.2.3 1.19.2.4 cmGlobalMSYSMakefileGenerator.cxx 1.14 1.14.2.1 cmOrderDirectories.cxx 1.4.2.1 1.4.2.2

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Dec 31 10:14:32 EST 2008


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

Modified Files:
      Tag: CMake-2-6
	cmFileCommand.h cmFindPackageCommand.cxx 
	cmFindPackageCommand.h cmGlobalMSYSMakefileGenerator.cxx 
	cmOrderDirectories.cxx 
Log Message:
ENH: merge fixes for RC 6


Index: cmGlobalMSYSMakefileGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalMSYSMakefileGenerator.cxx,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C 2 -d -r1.14 -r1.14.2.1
*** cmGlobalMSYSMakefileGenerator.cxx	22 Oct 2007 16:48:39 -0000	1.14
--- cmGlobalMSYSMakefileGenerator.cxx	31 Dec 2008 15:14:29 -0000	1.14.2.1
***************
*** 79,83 ****
    mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
    this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
!   if(!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile())
      {
      cmSystemTools::Error
--- 79,86 ----
    mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
    this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
! 
!   if(!mf->IsSet("CMAKE_AR") &&
!       !this->CMakeInstance->GetIsInTryCompile() &&
!       !(1==l.size() && l[0]=="NONE"))
      {
      cmSystemTools::Error

Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.35.2.4
retrieving revision 1.35.2.5
diff -C 2 -d -r1.35.2.4 -r1.35.2.5
*** cmFileCommand.h	12 Sep 2008 14:56:20 -0000	1.35.2.4
--- cmFileCommand.h	31 Dec 2008 15:14:29 -0000	1.35.2.5
***************
*** 146,150 ****
        " a cmake style path into the native path style \\ for windows and / "
        "for UNIX.\n"
!       "DOWNLOAD will download the givin URL to the given file. "
        "If LOG var is specified a log of the download will be put in var. "
        "If STATUS var is specified the status of the operation will"
--- 146,150 ----
        " a cmake style path into the native path style \\ for windows and / "
        "for UNIX.\n"
!       "DOWNLOAD will download the given URL to the given file. "
        "If LOG var is specified a log of the download will be put in var. "
        "If STATUS var is specified the status of the operation will"

Index: cmFindPackageCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.h,v
retrieving revision 1.19.2.3
retrieving revision 1.19.2.4
diff -C 2 -d -r1.19.2.3 -r1.19.2.4
*** cmFindPackageCommand.h	12 Sep 2008 14:56:21 -0000	1.19.2.3
--- cmFindPackageCommand.h	31 Dec 2008 15:14:29 -0000	1.19.2.4
***************
*** 76,79 ****
--- 76,81 ----
    void SetModuleVariables(const std::string& components);
    bool FindModule(bool& found);
+   void AddFindDefinition(const char* var, const char* val);
+   void RestoreFindDefinitions();
    bool HandlePackageMode();
    void FindConfig();
***************
*** 105,108 ****
--- 107,113 ----
    friend class cmFindPackageFileList;
  
+   struct OriginalDef { bool exists; std::string value; };
+   std::map<cmStdString, OriginalDef> OriginalDefs;
+ 
    std::string CommandDocumentation;
    cmStdString Name;

Index: cmOrderDirectories.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmOrderDirectories.cxx,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C 2 -d -r1.4.2.1 -r1.4.2.2
*** cmOrderDirectories.cxx	30 Jul 2008 18:54:49 -0000	1.4.2.1
--- cmOrderDirectories.cxx	31 Dec 2008 15:14:30 -0000	1.4.2.2
***************
*** 114,136 ****
                                                     std::string const& name)
  {
!   // Check if the file will be built by cmake.
!   std::set<cmStdString> const& files =
!     (this->GlobalGenerator->GetDirectoryContent(dir, false));
!   if(std::set<cmStdString>::const_iterator(files.find(name)) != files.end())
!     {
!     return true;
!     }
! 
!   // Check if the file exists on disk and is not a symlink back to the
!   // original file.
    std::string file = dir;
    file += "/";
    file += name;
!   if(cmSystemTools::FileExists(file.c_str(), true) &&
!      !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str()))
      {
!     return true;
      }
!   return false;
  }
  
--- 114,133 ----
                                                     std::string const& name)
  {
!   // Check if the file exists on disk.
    std::string file = dir;
    file += "/";
    file += name;
!   if(cmSystemTools::FileExists(file.c_str(), true))
      {
!     // The file conflicts only if it is not the same as the original
!     // file due to a symlink or hardlink.
!     return !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str());
      }
! 
!   // Check if the file will be built by cmake.
!   std::set<cmStdString> const& files =
!     (this->GlobalGenerator->GetDirectoryContent(dir, false));
!   std::set<cmStdString>::const_iterator fi = files.find(name);
!   return fi != files.end();
  }
  

Index: cmFindPackageCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.cxx,v
retrieving revision 1.36.2.5
retrieving revision 1.36.2.6
diff -C 2 -d -r1.36.2.5 -r1.36.2.6
*** cmFindPackageCommand.cxx	24 Oct 2008 15:18:46 -0000	1.36.2.5
--- cmFindPackageCommand.cxx	31 Dec 2008 15:14:29 -0000	1.36.2.6
***************
*** 223,226 ****
--- 223,229 ----
      "  <prefix>/                                               (W)\n"
      "  <prefix>/(cmake|CMake)/                                 (W)\n"
+     "  <prefix>/<name>*/                                       (W)\n"
+     "  <prefix>/<name>*/(cmake|CMake)/                         (W)\n"
+     "  <prefix>/(share|lib)/cmake/<name>*/                     (U)\n"
      "  <prefix>/(share|lib)/<name>*/                           (U)\n"
      "  <prefix>/(share|lib)/<name>*/(cmake|CMake)/             (U)\n"
***************
*** 423,427 ****
        // is required.
        std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i];
!       this->Makefile->AddDefinition(req_var.c_str(), "1");
  
        // Append to the list of required components.
--- 426,430 ----
        // is required.
        std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i];
!       this->AddFindDefinition(req_var.c_str(), "1");
  
        // Append to the list of required components.
***************
*** 580,584 ****
    // Store the list of components.
    std::string components_var = this->Name + "_FIND_COMPONENTS";
!   this->Makefile->AddDefinition(components_var.c_str(), components.c_str());
     
    if(this->Quiet)
--- 583,587 ----
    // Store the list of components.
    std::string components_var = this->Name + "_FIND_COMPONENTS";
!   this->AddFindDefinition(components_var.c_str(), components.c_str());
     
    if(this->Quiet)
***************
*** 588,592 ****
      std::string quietly = this->Name;
      quietly += "_FIND_QUIETLY";
!     this->Makefile->AddDefinition(quietly.c_str(), "1");
      }
  
--- 591,595 ----
      std::string quietly = this->Name;
      quietly += "_FIND_QUIETLY";
!     this->AddFindDefinition(quietly.c_str(), "1");
      }
  
***************
*** 597,601 ****
      std::string req = this->Name;
      req += "_FIND_REQUIRED";
!     this->Makefile->AddDefinition(req.c_str(), "1");
      }
  
--- 600,604 ----
      std::string req = this->Name;
      req += "_FIND_REQUIRED";
!     this->AddFindDefinition(req.c_str(), "1");
      }
  
***************
*** 606,630 ****
      std::string ver = this->Name;
      ver += "_FIND_VERSION";
!     this->Makefile->AddDefinition(ver.c_str(), this->Version.c_str());
      char buf[64];
      sprintf(buf, "%u", this->VersionMajor);
!     this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf);
      sprintf(buf, "%u", this->VersionMinor);
!     this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf);
      sprintf(buf, "%u", this->VersionPatch);
!     this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf);
      sprintf(buf, "%u", this->VersionTweak);
!     this->Makefile->AddDefinition((ver+"_TWEAK").c_str(), buf);
      sprintf(buf, "%u", this->VersionCount);
!     this->Makefile->AddDefinition((ver+"_COUNT").c_str(), buf);
  
      // Tell the module whether an exact version has been requested.
      std::string exact = this->Name;
      exact += "_FIND_VERSION_EXACT";
!     this->Makefile->AddDefinition(exact.c_str(),
!                                   this->VersionExact? "1":"0");
     }
  }
  
  
  //----------------------------------------------------------------------------
--- 609,664 ----
      std::string ver = this->Name;
      ver += "_FIND_VERSION";
!     this->AddFindDefinition(ver.c_str(), this->Version.c_str());
      char buf[64];
      sprintf(buf, "%u", this->VersionMajor);
!     this->AddFindDefinition((ver+"_MAJOR").c_str(), buf);
      sprintf(buf, "%u", this->VersionMinor);
!     this->AddFindDefinition((ver+"_MINOR").c_str(), buf);
      sprintf(buf, "%u", this->VersionPatch);
!     this->AddFindDefinition((ver+"_PATCH").c_str(), buf);
      sprintf(buf, "%u", this->VersionTweak);
!     this->AddFindDefinition((ver+"_TWEAK").c_str(), buf);
      sprintf(buf, "%u", this->VersionCount);
!     this->AddFindDefinition((ver+"_COUNT").c_str(), buf);
  
      // Tell the module whether an exact version has been requested.
      std::string exact = this->Name;
      exact += "_FIND_VERSION_EXACT";
!     this->AddFindDefinition(exact.c_str(), this->VersionExact? "1":"0");
     }
  }
  
+ //----------------------------------------------------------------------------
+ void cmFindPackageCommand::AddFindDefinition(const char* var, const char* val)
+ {
+   if(const char* old = this->Makefile->GetDefinition(var))
+     {
+     this->OriginalDefs[var].exists = true;
+     this->OriginalDefs[var].value = old;
+     }
+   else
+     {
+     this->OriginalDefs[var].exists = false;
+     }
+   this->Makefile->AddDefinition(var, val);
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmFindPackageCommand::RestoreFindDefinitions()
+ {
+   for(std::map<cmStdString, OriginalDef>::iterator
+         i = this->OriginalDefs.begin(); i != this->OriginalDefs.end(); ++i)
+     {
+     OriginalDef const& od = i->second;
+     if(od.exists)
+       {
+       this->Makefile->AddDefinition(i->first.c_str(), od.value.c_str());
+       }
+     else
+       {
+       this->Makefile->RemoveDefinition(i->first.c_str());
+       }
+     }
+ }
  
  //----------------------------------------------------------------------------
***************
*** 1009,1012 ****
--- 1043,1049 ----
        }
      }
+ 
+   // Restore original state of "_FIND_" variables we set.
+   this->RestoreFindDefinitions();
  }
  
***************
*** 1264,1267 ****
--- 1301,1305 ----
    // The version file will be loaded in an isolated scope.
    this->Makefile->PushScope();
+   this->Makefile->PushPolicy();
  
    // Clear the output variables.
***************
*** 1330,1333 ****
--- 1368,1372 ----
  
    // Restore the original scope.
+   this->Makefile->PopPolicy();
    this->Makefile->PopScope();
  
***************
*** 1747,1750 ****
--- 1786,1814 ----
    }
  
+   //  PREFIX/(Foo|foo|FOO).*/
+   {
+   cmFindPackageFileList lister(this);
+   lister
+     / cmFileListGeneratorFixed(prefix)
+     / cmFileListGeneratorProject(this->Names);
+   if(lister.Search())
+     {
+     return true;
+     }
+   }
+ 
+   //  PREFIX/(Foo|foo|FOO).*/(cmake|CMake)/
+   {
+   cmFindPackageFileList lister(this);
+   lister
+     / cmFileListGeneratorFixed(prefix)
+     / cmFileListGeneratorProject(this->Names)
+     / cmFileListGeneratorCaseInsensitive("cmake");
+   if(lister.Search())
+     {
+     return true;
+     }
+   }
+ 
    // Construct list of common install locations (lib and share).
    std::vector<std::string> common;
***************
*** 1756,1759 ****
--- 1820,1837 ----
    common.push_back("share");
  
+   //  PREFIX/(share|lib)/cmake/(Foo|foo|FOO).*/
+   {
+   cmFindPackageFileList lister(this);
+   lister
+     / cmFileListGeneratorFixed(prefix)
+     / cmFileListGeneratorEnumerate(common)
+     / cmFileListGeneratorFixed("cmake")
+     / cmFileListGeneratorProject(this->Names);
+   if(lister.Search())
+     {
+     return true;
+     }
+   }
+ 
    //  PREFIX/(share|lib)/(Foo|foo|FOO).*/
    {
***************
*** 1900,1911 ****
  }
  
- // TODO: Version numbers?  Perhaps have a listing component class that
- // sorts by lexicographic and numerical ordering.  Also try to match
- // some command argument for the version.  Alternatively provide an
- // API that just returns a list of valid directories?  Perhaps push a
- // scope and try loading the target file just to get its version
- // number?  Could add a foo-version.cmake or FooVersion.cmake file
- // in the projects that contains just version information.
- 
  // TODO: Debug cmsys::Glob double slash problem.
  
--- 1978,1981 ----



More information about the Cmake-commits mailing list