[Cmake-commits] [cmake-commits] king committed cmCMakeMinimumRequired.cxx 1.17 1.18 cmCMakePolicyCommand.cxx 1.2 1.3 cmPolicies.cxx 1.26 1.27

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 24 10:56:28 EDT 2008


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

Modified Files:
	cmCMakeMinimumRequired.cxx cmCMakePolicyCommand.cxx 
	cmPolicies.cxx 
Log Message:
ENH: Cleanup policy version interface presented to user.

  - In cmake_minimum_required do not set policy version if current
    CMake is too old
  - In cmPolicies::ApplyPolicyVersion report error if version is too
    new or cannot be parsed


Index: cmCMakePolicyCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCMakePolicyCommand.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmCMakePolicyCommand.cxx	5 Mar 2008 23:21:09 -0000	1.2
--- cmCMakePolicyCommand.cxx	24 Mar 2008 14:56:26 -0000	1.3
***************
*** 118,129 ****
      return false;
      }
!   if(!this->Makefile->SetPolicyVersion(args[1].c_str()))
!     {
!     cmOStringStream e;
!     e << "VERSION given invalid value \"" << args[1] << "\".  "
!       << "A numeric major.minor[.patch] must be given.";
!     this->SetError(e.str().c_str());
!     return false;
!     }
    return true;
  }
--- 118,122 ----
      return false;
      }
!   this->Makefile->SetPolicyVersion(args[1].c_str());
    return true;
  }

Index: cmPolicies.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPolicies.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -C 2 -d -r1.26 -r1.27
*** cmPolicies.cxx	21 Mar 2008 01:11:26 -0000	1.26
--- cmPolicies.cxx	24 Mar 2008 14:56:26 -0000	1.27
***************
*** 302,305 ****
--- 302,309 ----
              &majorVer, &minorVer, &patchVer) < 2)
      {
+     cmOStringStream e;
+     e << "Invalid policy version value \"" << ver << "\".  "
+       << "A numeric major.minor[.patch] must be given.";
+     mf->IssueMessage(cmake::FATAL_ERROR, e.str());
      return false;
      }
***************
*** 318,321 ****
--- 322,345 ----
        "One way to so this is to set the policy version to 2.4 exactly."
        );
+     return false;
+     }
+ 
+   // It is an error if the policy version is greater than the running
+   // CMake.
+   if (majorVer > cmVersion::GetMajorVersion() ||
+       (majorVer == cmVersion::GetMajorVersion() &&
+        minorVer > cmVersion::GetMinorVersion()) ||
+       (majorVer == cmVersion::GetMajorVersion() &&
+        minorVer == cmVersion::GetMinorVersion() &&
+        patchVer > cmVersion::GetPatchVersion()))
+     {
+     cmOStringStream e;
+     e << "An attempt was made to set the policy version of CMake to \""
+       << version << "\" which is greater than this version of CMake.  "
+       << "This is not allowed because the greater version may have new "
+       << "policies not known to this CMake.  "
+       << "You may need a newer CMake version to build this project.";
+     mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+     return false;
      }
  

Index: cmCMakeMinimumRequired.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCMakeMinimumRequired.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmCMakeMinimumRequired.cxx	7 Mar 2008 16:43:47 -0000	1.17
--- cmCMakeMinimumRequired.cxx	24 Mar 2008 14:56:26 -0000	1.18
***************
*** 100,110 ****
      // The current version is too low.
      cmOStringStream e;
!     e << "This project requires version " << version_string.c_str()
!       << " of CMake.  "
!       << "You are running version "
!       << current_major << "." << current_minor << "." << current_patch
!       << ".\n";
!     cmSystemTools::Error(e.str().c_str());
      cmSystemTools::SetFatalErrorOccured();
      }
  
--- 100,109 ----
      // The current version is too low.
      cmOStringStream e;
!     e << "CMake " << version_string.c_str()
!       << " or higher is required.  You are running version "
!       << current_major << "." << current_minor << "." << current_patch;
!     this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
      cmSystemTools::SetFatalErrorOccured();
+     return true;
      }
  



More information about the Cmake-commits mailing list