[Cmake-commits] [cmake-commits] king committed cmFindPackageCommand.cxx 1.47 1.48

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Oct 3 10:41:17 EDT 2008


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

Modified Files:
	cmFindPackageCommand.cxx 
Log Message:
ENH: Add UNSUITABLE result to package version test

Package version test files may now declare that they are unsuitable for
use with the project testing them.  This is important when the version
being tested does not provide a compatible ABI with the project target
environment.


Index: cmFindPackageCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindPackageCommand.cxx,v
retrieving revision 1.47
retrieving revision 1.48
diff -C 2 -d -r1.47 -r1.48
*** cmFindPackageCommand.cxx	3 Oct 2008 14:40:05 -0000	1.47
--- cmFindPackageCommand.cxx	3 Oct 2008 14:41:15 -0000	1.48
***************
*** 191,194 ****
--- 191,195 ----
      "  PACKAGE_VERSION_EXACT      = true if version is exact match\n"
      "  PACKAGE_VERSION_COMPATIBLE = true if version is compatible\n"
+     "  PACKAGE_VERSION_UNSUITABLE = true if unsuitable as any version\n"
      "These variables are checked by the find_package command to determine "
      "whether the configuration file provides an acceptable version.  "
***************
*** 1274,1277 ****
--- 1275,1279 ----
    // Clear the output variables.
    this->Makefile->RemoveDefinition("PACKAGE_VERSION");
+   this->Makefile->RemoveDefinition("PACKAGE_VERSION_UNSUITABLE");
    this->Makefile->RemoveDefinition("PACKAGE_VERSION_COMPATIBLE");
    this->Makefile->RemoveDefinition("PACKAGE_VERSION_EXACT");
***************
*** 1294,1307 ****
  
    // Load the version check file.
!   bool found = false;
    if(this->ReadListFile(version_file.c_str()))
      {
      // Check the output variables.
!     found = this->Makefile->IsOn("PACKAGE_VERSION_EXACT");
!     if(!found && !this->VersionExact)
        {
!       found = this->Makefile->IsOn("PACKAGE_VERSION_COMPATIBLE");
        }
!     if(found || this->Version.empty())
        {
        // Get the version found.
--- 1296,1314 ----
  
    // Load the version check file.
!   bool suitable = false;
    if(this->ReadListFile(version_file.c_str()))
      {
      // Check the output variables.
!     bool okay = this->Makefile->IsOn("PACKAGE_VERSION_EXACT");
!     bool unsuitable = this->Makefile->IsOn("PACKAGE_VERSION_UNSUITABLE");
!     if(!okay && !this->VersionExact)
        {
!       okay = this->Makefile->IsOn("PACKAGE_VERSION_COMPATIBLE");
        }
! 
!     // The package is suitable if the version is okay and not
!     // explicitly unsuitable.
!     suitable = !unsuitable && (okay || this->Version.empty());
!     if(suitable)
        {
        // Get the version found.
***************
*** 1333,1338 ****
    this->Makefile->PopScope();
  
!   // Succeed if the version was found or no version was requested.
!   return found || this->Version.empty();
  }
  
--- 1340,1345 ----
    this->Makefile->PopScope();
  
!   // Succeed if the version is suitable.
!   return suitable;
  }
  



More information about the Cmake-commits mailing list