[Cmake-commits] [cmake-commits] king committed cmTarget.cxx 1.218 1.219 cmTarget.h 1.115 1.116

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jul 9 10:09:02 EDT 2008


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

Modified Files:
	cmTarget.cxx cmTarget.h 
Log Message:
ENH: Add full target version signature cmTarget::GetTargetVersion.


Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.115
retrieving revision 1.116
diff -C 2 -d -r1.115 -r1.116
*** cmTarget.h	12 May 2008 21:43:45 -0000	1.115
--- cmTarget.h	9 Jul 2008 14:09:00 -0000	1.116
***************
*** 266,269 ****
--- 266,274 ----
    void GetTargetVersion(int& major, int& minor);
  
+   /** Get the target major, minor, and patch version numbers
+       interpreted from the VERSION or SOVERSION property.  Version 0
+       is returned if the property is not set or cannot be parsed.  */
+   void GetTargetVersion(bool soversion, int& major, int& minor, int& patch);
+ 
    /**
     * Trace through the source files in this target and add al source files

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.218
retrieving revision 1.219
diff -C 2 -d -r1.218 -r1.219
*** cmTarget.cxx	17 May 2008 16:53:56 -0000	1.218
--- cmTarget.cxx	9 Jul 2008 14:09:00 -0000	1.219
***************
*** 1757,1766 ****
  void cmTarget::GetTargetVersion(int& major, int& minor)
  {
    // Set the default values.
    major = 0;
    minor = 0;
  
!   // Look for a VERSION property.
!   if(const char* version = this->GetProperty("VERSION"))
      {
      // Try to parse the version number and store the results that were
--- 1757,1776 ----
  void cmTarget::GetTargetVersion(int& major, int& minor)
  {
+   int patch;
+   this->GetTargetVersion(false, major, minor, patch);
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmTarget::GetTargetVersion(bool soversion,
+                                 int& major, int& minor, int& patch)
+ {
    // Set the default values.
    major = 0;
    minor = 0;
+   patch = 0;
  
!   // Look for a VERSION or SOVERSION property.
!   const char* prop = soversion? "SOVERSION" : "VERSION";
!   if(const char* version = this->GetProperty(prop))
      {
      // Try to parse the version number and store the results that were
***************
*** 1768,1773 ****
      int parsed_major;
      int parsed_minor;
!     switch(sscanf(version, "%d.%d", &parsed_major, &parsed_minor))
        {
        case 2: minor = parsed_minor; // no break!
        case 1: major = parsed_major; // no break!
--- 1778,1786 ----
      int parsed_major;
      int parsed_minor;
!     int parsed_patch;
!     switch(sscanf(version, "%d.%d.%d",
!                   &parsed_major, &parsed_minor, &parsed_patch))
        {
+       case 3: patch = parsed_patch; // no break!
        case 2: minor = parsed_minor; // no break!
        case 1: major = parsed_major; // no break!



More information about the Cmake-commits mailing list