[Cmake-commits] [cmake-commits] hoffman committed cmFileCommand.cxx 1.103.2.6 1.103.2.7 cmFileCommand.h 1.35.2.3 1.35.2.4 cmFindPackageCommand.cxx 1.36.2.3 1.36.2.4 cmFindPackageCommand.h 1.19.2.2 1.19.2.3 cmGlobalXCodeGenerator.cxx 1.186.2.7 1.186.2.8 cmIfCommand.cxx 1.84.2.2 1.84.2.3 cmIfCommand.h 1.46.2.2 1.46.2.3 cmLocalVisualStudio6Generator.cxx 1.141.2.2 1.141.2.3 cmLocalVisualStudio7Generator.cxx 1.217.2.10 1.217.2.11 cmPolicies.cxx 1.20.2.7 1.20.2.8 cmPolicies.h 1.10.2.5 1.10.2.6

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Sep 12 10:56:23 EDT 2008


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

Modified Files:
      Tag: CMake-2-6
	cmFileCommand.cxx cmFileCommand.h cmFindPackageCommand.cxx 
	cmFindPackageCommand.h cmGlobalXCodeGenerator.cxx 
	cmIfCommand.cxx cmIfCommand.h 
	cmLocalVisualStudio6Generator.cxx 
	cmLocalVisualStudio7Generator.cxx cmPolicies.cxx cmPolicies.h 
Log Message:
ENH: 2.6.2 RC 4 merge into main tree


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.217.2.10
retrieving revision 1.217.2.11
diff -C 2 -d -r1.217.2.10 -r1.217.2.11
*** cmLocalVisualStudio7Generator.cxx	4 Sep 2008 21:10:45 -0000	1.217.2.10
--- cmLocalVisualStudio7Generator.cxx	12 Sep 2008 14:56:21 -0000	1.217.2.11
***************
*** 461,465 ****
     "TRUE", 0},
    {"ModuleDefinitionFile", "DEF:", "add an export def file", "",
!    cmVS7FlagTable::UserValue},
    {0,0,0,0,0}
  };
--- 461,466 ----
     "TRUE", 0},
    {"ModuleDefinitionFile", "DEF:", "add an export def file", "",
!    cmVS7FlagTable::UserValue}, 
!   {"GenerateMapFile", "MAP", "enable generation of map file", "TRUE", 0},
    {0,0,0,0,0}
  };

Index: cmPolicies.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.h,v
retrieving revision 1.10.2.5
retrieving revision 1.10.2.6
diff -C 2 -d -r1.10.2.5 -r1.10.2.6
*** cmPolicies.h	3 Sep 2008 13:43:18 -0000	1.10.2.5
--- cmPolicies.h	12 Sep 2008 14:56:21 -0000	1.10.2.6
***************
*** 50,53 ****
--- 50,54 ----
      CMP0007, // list command handling of empty elements
      CMP0008, // Full-path libraries must be a valid library file name
+     CMP0009, // GLOB_RECURSE should not follow symlinks by default
  
      // Always the last entry.  Useful mostly to avoid adding a comma

Index: cmPolicies.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.cxx,v
retrieving revision 1.20.2.7
retrieving revision 1.20.2.8
diff -C 2 -d -r1.20.2.7 -r1.20.2.8
*** cmPolicies.cxx	3 Sep 2008 13:43:18 -0000	1.20.2.7
--- cmPolicies.cxx	12 Sep 2008 14:56:21 -0000	1.20.2.8
***************
*** 308,311 ****
--- 308,327 ----
      "pass it directly to the native build tool unchanged.",
      2,6,1, cmPolicies::WARN);
+ 
+   this->DefinePolicy(
+     CMP0009, "CMP0009",
+     "FILE GLOB_RECURSE calls should not follow symlinks by default.",
+     "In CMake 2.6.1 and below, FILE GLOB_RECURSE calls would follow "
+     "through symlinks, sometimes coming up with unexpectedly large "
+     "result sets because of symlinks to top level directories that "
+     "contain hundreds of thousands of files."
+     "\n"
+     "This policy determines whether or not to follow symlinks "
+     "encountered during a FILE GLOB_RECURSE call. "
+     "The OLD behavior for this policy is to follow the symlinks. "
+     "The NEW behavior for this policy is not to follow the symlinks "
+     "by default, but only if FOLLOW_SYMLINKS is given as an additional "
+     "argument to the FILE command.",
+     2,6,2, cmPolicies::WARN);
  }
  
***************
*** 385,389 ****
        "than 2.4 set policy CMP0001 to OLD to tell CMake to check the "
        "CMAKE_BACKWARDS_COMPATIBILITY variable.  "
!       "One way to so this is to set the policy version to 2.4 exactly."
        );
      return false;
--- 401,405 ----
        "than 2.4 set policy CMP0001 to OLD to tell CMake to check the "
        "CMAKE_BACKWARDS_COMPATIBILITY variable.  "
!       "One way to do this is to set the policy version to 2.4 exactly."
        );
      return false;

Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.84.2.2
retrieving revision 1.84.2.3
diff -C 2 -d -r1.84.2.2 -r1.84.2.3
*** cmIfCommand.cxx	3 Sep 2008 13:43:17 -0000	1.84.2.2
--- cmIfCommand.cxx	12 Sep 2008 14:56:21 -0000	1.84.2.3
***************
*** 236,239 ****
--- 236,266 ----
        }
    }
+ 
+   enum Op { OpLess, OpEqual, OpGreater };
+   bool HandleVersionCompare(Op op, const char* lhs_str, const char* rhs_str)
+   {
+     // Parse out up to 4 components.
+   unsigned int lhs[4] = {0,0,0,0};
+   unsigned int rhs[4] = {0,0,0,0};
+   sscanf(lhs_str, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]);
+   sscanf(rhs_str, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]);
+ 
+   // Do component-wise comparison.
+   for(unsigned int i=0; i < 4; ++i)
+     {
+     if(lhs[i] < rhs[i])
+       {
+       // lhs < rhs, so true if operation is LESS
+       return op == OpLess;
+       }
+     else if(lhs[i] > rhs[i])
+       {
+       // lhs > rhs, so true if operation is GREATER
+       return op == OpGreater;
+       }
+     }
+   // lhs == rhs, so true if operation is EQUAL
+   return op == OpEqual;
+   }
  }
  
***************
*** 566,569 ****
--- 593,627 ----
          }
  
+       if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
+         (*(argP1) == "VERSION_LESS" || *(argP1) == "VERSION_GREATER" ||
+          *(argP1) == "VERSION_EQUAL"))
+         {
+         def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
+         def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+         Op op = OpEqual;
+         if(*argP1 == "VERSION_LESS")
+           {
+           op = OpLess;
+           }
+         else if(*argP1 == "VERSION_GREATER")
+           {
+           op = OpGreater;
+           }
+         bool result = HandleVersionCompare(op, def, def2);
+         if(result)
+           {
+           *arg = "1";
+           }
+         else
+           {
+           *arg = "0";
+           }
+         newArgs.erase(argP2);
+         newArgs.erase(argP1);
+         argP1 = arg;
+         IncrementArguments(newArgs,argP1,argP2);
+         reducible = 1;
+         }
+ 
        // is file A newer than file B
        if (argP1 != newArgs.end() && argP2 != newArgs.end() &&

Index: cmIfCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.h,v
retrieving revision 1.46.2.2
retrieving revision 1.46.2.3
diff -C 2 -d -r1.46.2.2 -r1.46.2.3
*** cmIfCommand.h	3 Sep 2008 13:43:17 -0000	1.46.2.2
--- cmIfCommand.h	12 Sep 2008 14:56:21 -0000	1.46.2.3
***************
*** 178,181 ****
--- 178,186 ----
        "True if the given string or variable's value is lexicographically "
        "less (or greater, or equal) than the string on the right.\n"
+       "  if(version1 VERSION_LESS version2)\n"
+       "  if(version1 VERSION_EQUAL version2)\n"
+       "  if(version1 VERSION_GREATER version2)\n"
+       "Component-wise integer version number comparison (version format is "
+       "major[.minor[.patch[.tweak]]]).\n"
        "  if(DEFINED variable)\n"
        "True if the given variable is defined. It does not matter if the "

Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.186.2.7
retrieving revision 1.186.2.8
diff -C 2 -d -r1.186.2.7 -r1.186.2.8
*** cmGlobalXCodeGenerator.cxx	3 Sep 2008 13:43:17 -0000	1.186.2.7
--- cmGlobalXCodeGenerator.cxx	12 Sep 2008 14:56:21 -0000	1.186.2.8
***************
*** 527,530 ****
--- 527,531 ----
    buildFile->AddAttribute("settings", settings);
    fileRef->AddAttribute("fileEncoding", this->CreateString("4"));
+ 
    const char* lang = 
      this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
***************
*** 532,535 ****
--- 533,537 ----
    std::string ext = sf->GetExtension();
    ext = cmSystemTools::LowerCase(ext);
+ 
    if(ext == "o")
      {
***************
*** 542,546 ****
    else if(ext == "m")
      {
!     sourcecode += ".cpp.objc";
      }
    else if(ext == "plist")
--- 544,548 ----
    else if(ext == "m")
      {
!     sourcecode += ".c.objc";
      }
    else if(ext == "plist")
***************
*** 548,574 ****
      sourcecode += ".text.plist";
      }
!   else if(!lang)
!     {
!     sourcecode += ext;
!     sourcecode += ".";
!     sourcecode += ext;
!     }
!   else if(strcmp(lang, "C") == 0)
      {
!     sourcecode += ".c.c";
      }
!   else if(strcmp(lang, "CXX") == 0)
      {
      sourcecode += ".cpp.cpp";
      }
!   else
      {
!     sourcecode += ext;
!     sourcecode += ".";
!     sourcecode += ext;
      }
    fileRef->AddAttribute("lastKnownFileType", 
                          this->CreateString(sourcecode.c_str()));
!   std::string path = 
      this->ConvertToRelativeForXCode(sf->GetFullPath().c_str());
    std::string dir;
--- 550,585 ----
      sourcecode += ".text.plist";
      }
!   else if(ext == "h" || ext == "hxx" || ext == "hpp")
      {
!     const char* linkLanguage = cmtarget.GetLinkerLanguage(this);
!     if(linkLanguage && (std::string(linkLanguage) == "CXX"))
!       {
!       sourcecode += ".cpp.h";
!       }
!     else
!       {
!       sourcecode += ".c.h";
!       }
      }
!   else if(lang && strcmp(lang, "CXX") == 0)
      {
      sourcecode += ".cpp.cpp";
      }
!   else if(lang && strcmp(lang, "C") == 0)
      {
!     sourcecode += ".c.c";
      }
+   //else
+   //  {
+   //  // Already specialized above or we leave sourcecode == "sourcecode"
+   //  // which is probably the most correct choice. Extensionless headers,
+   //  // for example... Or file types unknown to Xcode that do not map to a
+   //  // valid lastKnownFileType value.
+   //  }
+ 
    fileRef->AddAttribute("lastKnownFileType", 
                          this->CreateString(sourcecode.c_str()));
! 
!   std::string path =
      this->ConvertToRelativeForXCode(sf->GetFullPath().c_str());
    std::string dir;
***************
*** 576,580 ****
    cmSystemTools::SplitProgramPath(sf->GetFullPath().c_str(),
                                    dir, file);
!   
    fileRef->AddAttribute("name", this->CreateString(file.c_str()));
    fileRef->AddAttribute("path", this->CreateString(path.c_str()));
--- 587,591 ----
    cmSystemTools::SplitProgramPath(sf->GetFullPath().c_str(),
                                    dir, file);
! 
    fileRef->AddAttribute("name", this->CreateString(file.c_str()));
    fileRef->AddAttribute("path", this->CreateString(path.c_str()));
***************
*** 591,594 ****
--- 602,606 ----
      fileRef->AddAttribute("sourceTree", this->CreateString("<absolute>"));
      }
+ 
    return buildFile;
  }
***************
*** 694,698 ****
          externalObjFiles.push_back(xsf);
          }
!       else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY"))
          {
          headerFiles.push_back(xsf);
--- 706,712 ----
          externalObjFiles.push_back(xsf);
          }
!       else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY") ||
!         (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) ||
!         (tsFlags.Type == cmTarget::SourceFileTypePublicHeader))
          {
          headerFiles.push_back(xsf);
***************
*** 1004,1008 ****
    std::string retFlag;
    std::string::size_type pos = flags.find(flag);
!   if(pos != flags.npos && (pos ==0 || flags[pos]==' '))
      {
      while(pos < flags.size() && flags[pos] != ' ')
--- 1018,1022 ----
    std::string retFlag;
    std::string::size_type pos = flags.find(flag);
!   if(pos != flags.npos && (pos ==0 || flags[pos-1]==' '))
      {
      while(pos < flags.size() && flags[pos] != ' ')

Index: cmFindPackageCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.h,v
retrieving revision 1.19.2.2
retrieving revision 1.19.2.3
diff -C 2 -d -r1.19.2.2 -r1.19.2.3
*** cmFindPackageCommand.h	3 Sep 2008 13:43:17 -0000	1.19.2.2
--- cmFindPackageCommand.h	12 Sep 2008 14:56:21 -0000	1.19.2.3
***************
*** 74,77 ****
--- 74,78 ----
    void AppendSuccessInformation();
    void AppendToProperty(const char* propertyName);
+   void SetModuleVariables(const std::string& components);
    bool FindModule(bool& found);
    bool HandlePackageMode();
***************
*** 111,114 ****
--- 112,116 ----
    unsigned int VersionMinor;
    unsigned int VersionPatch;
+   unsigned int VersionTweak;
    unsigned int VersionCount;
    bool VersionExact;
***************
*** 118,121 ****
--- 120,124 ----
    unsigned int VersionFoundMinor;
    unsigned int VersionFoundPatch;
+   unsigned int VersionFoundTweak;
    unsigned int VersionFoundCount;
    bool Quiet;

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.103.2.6
retrieving revision 1.103.2.7
diff -C 2 -d -r1.103.2.6 -r1.103.2.7
*** cmFileCommand.cxx	3 Sep 2008 13:43:17 -0000	1.103.2.6
--- cmFileCommand.cxx	12 Sep 2008 14:56:20 -0000	1.103.2.7
***************
*** 669,684 ****
    cmsys::Glob g;
    g.SetRecurse(recurse);
    std::string output = "";
    bool first = true;
    for ( ; i != args.end(); ++i )
      {
!     if ( *i == "RECURSE_SYMLINKS_OFF" )
        {
!       g.RecurseThroughSymlinksOff();
        ++i;
        if ( i == args.end() )
          {
          this->SetError(
!           "GLOB requires a glob expression after RECURSE_SYMLINKS_OFF");
          return false;
          }
--- 669,705 ----
    cmsys::Glob g;
    g.SetRecurse(recurse);
+ 
+   bool explicitFollowSymlinks = false;
+   cmPolicies::PolicyStatus status =
+     this->Makefile->GetPolicyStatus(cmPolicies::CMP0009);
+   if(recurse)
+     {
+     switch(status)
+       {
+       case cmPolicies::NEW:
+         g.RecurseThroughSymlinksOff();
+         break;
+       case cmPolicies::OLD:
+       case cmPolicies::WARN:
+       case cmPolicies::REQUIRED_IF_USED:
+       case cmPolicies::REQUIRED_ALWAYS:
+         g.RecurseThroughSymlinksOn();
+         break;
+       }
+     }
+ 
    std::string output = "";
    bool first = true;
    for ( ; i != args.end(); ++i )
      {
!     if ( recurse && (*i == "FOLLOW_SYMLINKS") )
        {
!       explicitFollowSymlinks = true;
!       g.RecurseThroughSymlinksOn();
        ++i;
        if ( i == args.end() )
          {
          this->SetError(
!           "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS");
          return false;
          }
***************
*** 733,736 ****
--- 754,788 ----
        }
      }
+ 
+   if(recurse && !explicitFollowSymlinks)
+     {
+     switch (status)
+       {
+       case cmPolicies::NEW:
+         // Correct behavior, yay!
+         break;
+       case cmPolicies::OLD:
+         // Probably not really the expected behavior, but the author explicitly
+         // asked for the old behavior... no warning.
+       case cmPolicies::WARN:
+         // Possibly unexpected old behavior *and* we actually traversed
+         // symlinks without being explicitly asked to: warn the author.
+         if(g.GetFollowedSymlinkCount() != 0)
+           {
+           this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+             this->Makefile->GetPolicies()->
+               GetPolicyWarning(cmPolicies::CMP0009));
+           }
+         break;
+       case cmPolicies::REQUIRED_IF_USED:
+       case cmPolicies::REQUIRED_ALWAYS:
+         this->SetError("policy CMP0009 error");
+         this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+           this->Makefile->GetPolicies()->
+             GetRequiredPolicyError(cmPolicies::CMP0009));
+         return false;
+       }
+     }
+ 
    this->Makefile->AddDefinition(variable.c_str(), output.c_str());
    return true;

Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.141.2.2
retrieving revision 1.141.2.3
diff -C 2 -d -r1.141.2.2 -r1.141.2.3
*** cmLocalVisualStudio6Generator.cxx	23 May 2008 20:09:36 -0000	1.141.2.2
--- cmLocalVisualStudio6Generator.cxx	12 Sep 2008 14:56:21 -0000	1.141.2.3
***************
*** 1315,1318 ****
--- 1315,1325 ----
  
    std::string line;
+   std::string libnameExports;
+   if(exportSymbol.size())
+     {
+     libnameExports = "/D \"";
+     libnameExports += exportSymbol;
+     libnameExports += "\"";
+     }
    while(cmSystemTools::GetLineFromStream(fin, line))
      {
***************
*** 1323,1327 ****
        }
      cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME_EXPORTS",
!                                  exportSymbol.c_str());
      cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG",
                                   mfcFlag);
--- 1330,1334 ----
        }
      cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME_EXPORTS",
!                                  libnameExports.c_str());
      cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG",
                                   mfcFlag);

Index: cmFindPackageCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.cxx,v
retrieving revision 1.36.2.3
retrieving revision 1.36.2.4
diff -C 2 -d -r1.36.2.3 -r1.36.2.4
*** cmFindPackageCommand.cxx	3 Sep 2008 13:43:17 -0000	1.36.2.3
--- cmFindPackageCommand.cxx	12 Sep 2008 14:56:20 -0000	1.36.2.4
***************
*** 68,71 ****
--- 68,72 ----
    this->VersionMinor = 0;
    this->VersionPatch = 0;
+   this->VersionTweak = 0;
    this->VersionCount = 0;
    this->VersionExact = false;
***************
*** 73,79 ****
    this->VersionFoundMinor = 0;
    this->VersionFoundPatch = 0;
    this->VersionFoundCount = 0;
    this->CommandDocumentation =
!     "  find_package(<package> [major[.minor[.patch]]] [EXACT] [QUIET]\n"
      "               [[REQUIRED|COMPONENTS] [components...]])\n"
      "Finds and loads settings from an external project.  "
--- 74,81 ----
    this->VersionFoundMinor = 0;
    this->VersionFoundPatch = 0;
+   this->VersionFoundTweak = 0;
    this->VersionFoundCount = 0;
    this->CommandDocumentation =
!     "  find_package(<package> [version] [EXACT] [QUIET]\n"
      "               [[REQUIRED|COMPONENTS] [components...]])\n"
      "Finds and loads settings from an external project.  "
***************
*** 87,92 ****
      "REQUIRED option or after the COMPONENTS option if no REQUIRED "
      "option is given.  "
!     "The \"[major[.minor[.patch]]]\" version argument specifies a desired "
!     "version with which the package found should be compatible.  "
      "The EXACT option requests that the version be matched exactly.  "
      "Version support is currently provided only on a package-by-package "
--- 89,94 ----
      "REQUIRED option or after the COMPONENTS option if no REQUIRED "
      "option is given.  "
!     "The [version] argument requests a version with which the package found "
!     "should be compatible (format is major[.minor[.patch[.tweak]]]).  "
      "The EXACT option requests that the version be matched exactly.  "
      "Version support is currently provided only on a package-by-package "
***************
*** 110,114 ****
      "If no module is found the command proceeds to Config mode.\n"
      "The complete Config mode command signature is:\n"
!     "  find_package(<package> [major[.minor[.patch]]] [EXACT] [QUIET]\n"
      "               [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n"
      "               [NAMES name1 [name2 ...]]\n"
--- 112,116 ----
      "If no module is found the command proceeds to Config mode.\n"
      "The complete Config mode command signature is:\n"
!     "  find_package(<package> [version] [EXACT] [QUIET]\n"
      "               [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n"
      "               [NAMES name1 [name2 ...]]\n"
***************
*** 154,160 ****
      "intervention is required."
      "\n"
!     "When the \"[major[.minor[.patch]]]\" version argument is specified "
!     "Config mode will only find a version of the package that claims "
!     "compatibility with the requested version.  "
      "If the EXACT option is given only a version of the package claiming "
      "an exact match of the requested version may be found.  "
--- 156,162 ----
      "intervention is required."
      "\n"
!     "When the [version] argument is given Config mode will only find a "
!     "version of the package that claims compatibility with the requested "
!     "version (format is major[.minor[.patch[.tweak]]]).  "
      "If the EXACT option is given only a version of the package claiming "
      "an exact match of the requested version may be found.  "
***************
*** 174,183 ****
      "  PACKAGE_FIND_NAME          = the <package> name\n"
      "  PACKAGE_FIND_VERSION       = full requested version string\n"
!     "  PACKAGE_FIND_VERSION_MAJOR = requested major version, if any\n"
!     "  PACKAGE_FIND_VERSION_MINOR = requested minor version, if any\n"
!     "  PACKAGE_FIND_VERSION_PATCH = requested patch version, if any\n"
      "The version file checks whether it satisfies the requested version "
      "and sets these variables:\n"
!     "  PACKAGE_VERSION            = package version (major[.minor[.patch]])\n"
      "  PACKAGE_VERSION_EXACT      = true if version is exact match\n"
      "  PACKAGE_VERSION_COMPATIBLE = true if version is compatible\n"
--- 176,187 ----
      "  PACKAGE_FIND_NAME          = the <package> name\n"
      "  PACKAGE_FIND_VERSION       = full requested version string\n"
!     "  PACKAGE_FIND_VERSION_MAJOR = major version if requested, else 0\n"
!     "  PACKAGE_FIND_VERSION_MINOR = minor version if requested, else 0\n"
!     "  PACKAGE_FIND_VERSION_PATCH = patch version if requested, else 0\n"
!     "  PACKAGE_FIND_VERSION_TWEAK = tweak version if requested, else 0\n"
!     "  PACKAGE_FIND_VERSION_COUNT = number of version components, 0 to 4\n"
      "The version file checks whether it satisfies the requested version "
      "and sets these variables:\n"
!     "  PACKAGE_VERSION            = full provided version string\n"
      "  PACKAGE_VERSION_EXACT      = true if version is exact match\n"
      "  PACKAGE_VERSION_COMPATIBLE = true if version is compatible\n"
***************
*** 186,193 ****
      "They are not available after the find_package call returns.  "
      "If the version is acceptable the following variables are set:\n"
!     "  <package>_VERSION       = package version (major[.minor[.patch]])\n"
!     "  <package>_VERSION_MAJOR = major from major[.minor[.patch]], if any\n"
!     "  <package>_VERSION_MINOR = minor from major[.minor[.patch]], if any\n"
!     "  <package>_VERSION_PATCH = patch from major[.minor[.patch]], if any\n"
      "and the corresponding package configuration file is loaded.  "
      "When multiple package configuration files are available whose version "
--- 190,199 ----
      "They are not available after the find_package call returns.  "
      "If the version is acceptable the following variables are set:\n"
!     "  <package>_VERSION       = full provided version string\n"
!     "  <package>_VERSION_MAJOR = major version if provided, else 0\n"
!     "  <package>_VERSION_MINOR = minor version if provided, else 0\n"
!     "  <package>_VERSION_PATCH = patch version if provided, else 0\n"
!     "  <package>_VERSION_TWEAK = tweak version if provided, else 0\n"
!     "  <package>_VERSION_COUNT = number of version components, 0 to 4\n"
      "and the corresponding package configuration file is loaded.  "
      "When multiple package configuration files are available whose version "
***************
*** 412,416 ****
        // Set a variable telling the find script this component
        // is required.
!       std::string req_var = Name + "_FIND_REQUIRED_" + args[i];
        this->Makefile->AddDefinition(req_var.c_str(), "1");
  
--- 418,422 ----
        // Set a variable telling the find script this component
        // is required.
!       std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i];
        this->Makefile->AddDefinition(req_var.c_str(), "1");
  
***************
*** 470,477 ****
      unsigned int parsed_minor;
      unsigned int parsed_patch;
!     this->VersionCount = sscanf(this->Version.c_str(), "%u.%u.%u",
!                                 &parsed_major, &parsed_minor, &parsed_patch);
      switch(this->VersionCount)
        {
        case 3: this->VersionPatch = parsed_patch; // no break!
        case 2: this->VersionMinor = parsed_minor; // no break!
--- 476,486 ----
      unsigned int parsed_minor;
      unsigned int parsed_patch;
!     unsigned int parsed_tweak;
!     this->VersionCount = sscanf(this->Version.c_str(), "%u.%u.%u.%u",
!                                 &parsed_major, &parsed_minor,
!                                 &parsed_patch, &parsed_tweak);
      switch(this->VersionCount)
        {
+       case 4: this->VersionTweak = parsed_tweak; // no break!
        case 3: this->VersionPatch = parsed_patch; // no break!
        case 2: this->VersionMinor = parsed_minor; // no break!
***************
*** 481,487 ****
      }
  
!   // Store the list of components.
!   std::string components_var = Name + "_FIND_COMPONENTS";
!   this->Makefile->AddDefinition(components_var.c_str(), components.c_str());
  
    // See if there is a Find<package>.cmake module.
--- 490,494 ----
      }
  
!   this->SetModuleVariables(components);
  
    // See if there is a Find<package>.cmake module.
***************
*** 534,537 ****
--- 541,598 ----
  }
  
+ 
+ //----------------------------------------------------------------------------
+ void cmFindPackageCommand::SetModuleVariables(const std::string& components)
+ {
+   // 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)
+     {
+     // Tell the module that is about to be read that it should find
+     // quietly.
+     std::string quietly = this->Name;
+     quietly += "_FIND_QUIETLY";
+     this->Makefile->AddDefinition(quietly.c_str(), "1");
+     }
+ 
+   if(this->Required)
+     {
+     // Tell the module that is about to be read that it should report
+     // a fatal error if the package is not found.
+     std::string req = this->Name;
+     req += "_FIND_REQUIRED";
+     this->Makefile->AddDefinition(req.c_str(), "1");
+     }
+ 
+   if(!this->Version.empty())
+     {
+     // Tell the module that is about to be read what version of the
+     // package has been requested.
+     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");
+    }
+ }
+ 
+ 
  //----------------------------------------------------------------------------
  bool cmFindPackageCommand::FindModule(bool& found)
***************
*** 543,599 ****
    if ( mfile.size() )
      {
-     if(this->Quiet)
-       {
-       // Tell the module that is about to be read that it should find
-       // quietly.
-       std::string quietly = this->Name;
-       quietly += "_FIND_QUIETLY";
-       this->Makefile->AddDefinition(quietly.c_str(), "1");
-       }
- 
-     if(this->Required)
-       {
-       // Tell the module that is about to be read that it should report
-       // a fatal error if the package is not found.
-       std::string req = this->Name;
-       req += "_FIND_REQUIRED";
-       this->Makefile->AddDefinition(req.c_str(), "1");
-       }
- 
-     if(!this->Version.empty())
-       {
-       // Tell the module that is about to be read what version of the
-       // package has been requested.
-       std::string ver = this->Name;
-       ver += "_FIND_VERSION";
-       this->Makefile->AddDefinition(ver.c_str(), this->Version.c_str());
-       char buf[64];
-       switch(this->VersionCount)
-         {
-         case 3:
-           {
-           sprintf(buf, "%u", this->VersionPatch);
-           this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf);
-           } // no break
-         case 2:
-           {
-           sprintf(buf, "%u", this->VersionMinor);
-           this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf);
-           } // no break
-         case 1:
-           {
-           sprintf(buf, "%u", this->VersionMajor);
-           this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf);
-           } // no break
-         default: break;
-         }
- 
-       // 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");
-       }
- 
      // Load the module we found.
      found = true;
--- 604,607 ----
***************
*** 692,696 ****
      // The variable is not set.
      cmOStringStream e;
!     e << "could not find ";
      if(!this->NoModule)
        {
--- 700,704 ----
      // The variable is not set.
      cmOStringStream e;
!     e << "Could not find ";
      if(!this->NoModule)
        {
***************
*** 722,734 ****
          }
        }
!     if(this->Required)
!       {
!       this->SetError(e.str().c_str());
!       result = false;
!       }
!     else
!       {
!       cmSystemTools::Error("find_package ", e.str().c_str());
!       }
      }
  
--- 730,735 ----
          }
        }
!     this->Makefile->IssueMessage(
!       this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str());
      }
  
***************
*** 1234,1267 ****
    this->Makefile->AddDefinition("PACKAGE_FIND_VERSION",
                                  this->Version.c_str());
!   if(this->VersionCount >= 3)
!     {
!     char buf[64];
!     sprintf(buf, "%u", this->VersionPatch);
!     this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_PATCH", buf);
!     }
!   else
!     {
!     this->Makefile->RemoveDefinition("PACKAGE_FIND_VERSION_PATCH");
!     }
!   if(this->VersionCount >= 2)
!     {
!     char buf[64];
!     sprintf(buf, "%u", this->VersionMinor);
!     this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_MINOR", buf);
!     }
!   else
!     {
!     this->Makefile->RemoveDefinition("PACKAGE_FIND_VERSION_MINOR");
!     }
!   if(this->VersionCount >= 1)
!     {
!     char buf[64];
!     sprintf(buf, "%u", this->VersionMajor);
!     this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_MAJOR", buf);
!     }
!   else
!     {
!     this->Makefile->RemoveDefinition("PACKAGE_FIND_VERSION_MAJOR");
!     }
  
    // Load the version check file.
--- 1235,1249 ----
    this->Makefile->AddDefinition("PACKAGE_FIND_VERSION",
                                  this->Version.c_str());
!   char buf[64];
!   sprintf(buf, "%u", this->VersionMajor);
!   this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_MAJOR", buf);
!   sprintf(buf, "%u", this->VersionMinor);
!   this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_MINOR", buf);
!   sprintf(buf, "%u", this->VersionPatch);
!   this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_PATCH", buf);
!   sprintf(buf, "%u", this->VersionTweak);
!   this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_TWEAK", buf);
!   sprintf(buf, "%u", this->VersionCount);
!   this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_COUNT", buf);
  
    // Load the version check file.
***************
*** 1286,1294 ****
        unsigned int parsed_minor;
        unsigned int parsed_patch;
        this->VersionFoundCount =
!         sscanf(this->VersionFound.c_str(), "%u.%u.%u",
!                &parsed_major, &parsed_minor, &parsed_patch);
        switch(this->VersionFoundCount)
          {
          case 3: this->VersionFoundPatch = parsed_patch; // no break!
          case 2: this->VersionFoundMinor = parsed_minor; // no break!
--- 1268,1279 ----
        unsigned int parsed_minor;
        unsigned int parsed_patch;
+       unsigned int parsed_tweak;
        this->VersionFoundCount =
!         sscanf(this->VersionFound.c_str(), "%u.%u.%u.%u",
!                &parsed_major, &parsed_minor,
!                &parsed_patch, &parsed_tweak);
        switch(this->VersionFoundCount)
          {
+         case 4: this->VersionFoundTweak = parsed_tweak; // no break!
          case 3: this->VersionFoundPatch = parsed_patch; // no break!
          case 2: this->VersionFoundMinor = parsed_minor; // no break!
***************
*** 1321,1345 ****
      }
  
!   // Store the portions that could be parsed.
    char buf[64];
!   switch(this->VersionFoundCount)
!     {
!     case 3:
!       {
!       sprintf(buf, "%u", this->VersionFoundPatch);
!       this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf);
!       } // no break
!     case 2:
!       {
!       sprintf(buf, "%u", this->VersionFoundMinor);
!       this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf);
!       } // no break
!     case 1:
!       {
!       sprintf(buf, "%u", this->VersionFoundMajor);
!       this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf);
!       } // no break
!     default: break;
!     }
  }
  
--- 1306,1321 ----
      }
  
!   // Store the version components.
    char buf[64];
!   sprintf(buf, "%u", this->VersionFoundMajor);
!   this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf);
!   sprintf(buf, "%u", this->VersionFoundMinor);
!   this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf);
!   sprintf(buf, "%u", this->VersionFoundPatch);
!   this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf);
!   sprintf(buf, "%u", this->VersionFoundTweak);
!   this->Makefile->AddDefinition((ver+"_TWEAK").c_str(), buf);
!   sprintf(buf, "%u", this->VersionFoundCount);
!   this->Makefile->AddDefinition((ver+"_COUNT").c_str(), buf);
  }
  

Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.35.2.3
retrieving revision 1.35.2.4
diff -C 2 -d -r1.35.2.3 -r1.35.2.4
*** cmFileCommand.h	3 Sep 2008 13:43:17 -0000	1.35.2.3
--- cmFileCommand.h	12 Sep 2008 14:56:20 -0000	1.35.2.4
***************
*** 78,82 ****
        "  file(GLOB variable [RELATIVE path] [globbing expressions]...)\n"
        "  file(GLOB_RECURSE variable [RELATIVE path] \n"
!       "       [RECURSE_SYMLINKS_OFF] [globbing expressions]...)\n"
        "  file(REMOVE [file1 ...])\n"
        "  file(REMOVE_RECURSE [file1 ...])\n"
--- 78,82 ----
        "  file(GLOB variable [RELATIVE path] [globbing expressions]...)\n"
        "  file(GLOB_RECURSE variable [RELATIVE path] \n"
!       "       [FOLLOW_SYMLINKS] [globbing expressions]...)\n"
        "  file(REMOVE [file1 ...])\n"
        "  file(REMOVE_RECURSE [file1 ...])\n"
***************
*** 125,133 ****
        "   *.vt?      - match all files with extension vta,...,vtz\n"
        "   f[3-5].txt - match files f3.txt, f4.txt, f5.txt\n"
!       "GLOB_RECURSE will generate similar list as the regular GLOB, except "
        "it will traverse all the subdirectories of the matched directory and "
!       "match the files. Subdirectories that are symlinks are traversed by "
!       "default to match the behavior of older CMake releases. Use "
!       "RECURSE_SYMLINKS_OFF to prevent recursion through symlinks.\n"
        "Examples of recursive globbing include:\n"
        "   /dir/*.py  - match all python files in /dir and subdirectories\n"
--- 125,133 ----
        "   *.vt?      - match all files with extension vta,...,vtz\n"
        "   f[3-5].txt - match files f3.txt, f4.txt, f5.txt\n"
!       "GLOB_RECURSE will generate a list similar to the regular GLOB, except "
        "it will traverse all the subdirectories of the matched directory and "
!       "match the files. Subdirectories that are symlinks are only traversed "
!       "if FOLLOW_SYMLINKS is given or cmake policy CMP0009 is not set to NEW. "
!       "See cmake --help-policy CMP0009 for more information.\n"
        "Examples of recursive globbing include:\n"
        "   /dir/*.py  - match all python files in /dir and subdirectories\n"



More information about the Cmake-commits mailing list