[Cmake-commits] [cmake-commits] king committed cmTarget.cxx 1.277 1.278 cmTarget.h 1.146 1.147

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 5 09:06:47 EDT 2009


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

Modified Files:
	cmTarget.cxx cmTarget.h 
Log Message:
Combine duplicate code in target property methods

In cmTarget::SetProperty and cmTarget::AppendProperty we check whether
changing the property invalidates cached information.  The check was
duplicated in the two methods, so this commit moves the check into a
helper method called from both.


Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.146
retrieving revision 1.147
diff -C 2 -d -r1.146 -r1.147
*** cmTarget.h	5 Oct 2009 13:06:29 -0000	1.146
--- cmTarget.h	5 Oct 2009 13:06:44 -0000	1.147
***************
*** 568,571 ****
--- 568,573 ----
    void ComputeLinkClosure(const char* config, LinkClosure& lc);
  
+   void MaybeInvalidatePropertyCache(const char* prop);
+ 
    // The cmMakefile instance that owns this target.  This should
    // always be set.

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.277
retrieving revision 1.278
diff -C 2 -d -r1.277 -r1.278
*** cmTarget.cxx	5 Oct 2009 13:06:29 -0000	1.277
--- cmTarget.cxx	5 Oct 2009 13:06:44 -0000	1.278
***************
*** 2002,2012 ****
  
    this->Properties.SetProperty(prop, value, cmProperty::TARGET);
! 
!   // If imported information is being set, wipe out cached
!   // information.
!   if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0)
!     {
!     this->Internal->ImportInfoMap.clear();
!     }
  }
  
--- 2002,2006 ----
  
    this->Properties.SetProperty(prop, value, cmProperty::TARGET);
!   this->MaybeInvalidatePropertyCache(prop);
  }
  
***************
*** 2019,2025 ****
      }
    this->Properties.AppendProperty(prop, value, cmProperty::TARGET);
  
!   // If imported information is being set, wipe out cached
!   // information.
    if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0)
      {
--- 2013,2023 ----
      }
    this->Properties.AppendProperty(prop, value, cmProperty::TARGET);
+   this->MaybeInvalidatePropertyCache(prop);
+ }
  
! //----------------------------------------------------------------------------
! void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
! {
!   // Wipe wipe out maps caching information affected by this property.
    if(this->IsImported() && strncmp(prop, "IMPORTED", 8) == 0)
      {



More information about the Cmake-commits mailing list