[Cmake-commits] CMake branch, next, updated. v3.5.1-781-g5d94f12

Brad King brad.king at kitware.com
Fri Apr 1 10:39:37 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  5d94f12a78d259d4453913f345b882067cf45333 (commit)
       via  e47ec3c9ffe0effce184bff89b36d893a5fda971 (commit)
       via  e1eae2a3fb5b03dca3275cc8c637286ae4ce1e2f (commit)
      from  67ca15ff15fe4fd0e8a873ff076517e6d5e312a3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d94f12a78d259d4453913f345b882067cf45333
commit 5d94f12a78d259d4453913f345b882067cf45333
Merge: 67ca15f e47ec3c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 1 10:39:33 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Apr 1 10:39:33 2016 -0400

    Merge topic 'fix-target-alias-in-subdir' into next
    
    e47ec3c9 Rename local target lookup methods to clarify purpose
    e1eae2a3 Fix lookup of an ALIAS target outside aliased target's directory (#16044)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e47ec3c9ffe0effce184bff89b36d893a5fda971
commit e47ec3c9ffe0effce184bff89b36d893a5fda971
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 1 10:26:08 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Apr 1 10:39:25 2016 -0400

    Rename local target lookup methods to clarify purpose
    
    Rename methods:
    
    * `cmMakefile::Find{ => LocalNonAlias}Target`
    * `cmLocalGenerator::Find{ => LocalNonAlias}GeneratorTarget`
    
    These names clarify that they are for directory-local target names
    and do not consider alias targets.

diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index d17d664..c64e813 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -117,7 +117,7 @@ void cmFLTKWrapUICommand::FinalPass()
   // people should add the srcs to the target themselves, but the old command
   // didn't support that, so check and see if they added the files in and if
   // they didn;t then print a warning and add then anyhow
-  cmTarget* target = this->Makefile->FindTarget(this->Target);
+  cmTarget* target = this->Makefile->FindLocalNonAliasTarget(this->Target);
   if(!target)
     {
     std::string msg =
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 2d78a41..7e72a8a 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -381,7 +381,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       return false;
       }
     // Lookup this target in the current directory.
-    if(cmTarget* target=this->Makefile->FindTarget(*targetIt))
+    if(cmTarget* target=this->Makefile->FindLocalNonAliasTarget(*targetIt))
       {
       // Found the target.  Check its type.
       if(target->GetType() != cmState::EXECUTABLE &&
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 5e88fa2..b93fb8d 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -446,7 +446,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmGeneratorTarget const* target,
 
 void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
 {
-  this->Target = lg->FindGeneratorTarget(this->TargetName);
+  this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6153fbd..586e4c6 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -485,7 +485,7 @@ private:
   std::string Name;
 };
 
-cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
+cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
     const std::string& name) const
 {
   std::vector<cmGeneratorTarget*>::const_iterator ti =
@@ -1828,7 +1828,7 @@ cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const
     return *imported;
     }
 
-  if(cmGeneratorTarget* t = this->FindGeneratorTarget(name))
+  if(cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name))
     {
     return t;
     }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 68e7667..b673a85 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -129,7 +129,8 @@ public:
   void AddImportedGeneratorTarget(cmGeneratorTarget* gt);
   void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt);
 
-  cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const;
+  cmGeneratorTarget*
+    FindLocalNonAliasGeneratorTarget(const std::string& name) const;
   cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
 
   /**
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 598f8c4..df687d0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4058,7 +4058,7 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const
   return this->StateSnapshot.GetDirectory().GetPropertyKeys();
 }
 
-cmTarget* cmMakefile::FindTarget(const std::string& name) const
+cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
 {
   cmTargets::iterator i = this->Targets.find( name );
   if ( i != this->Targets.end() )
@@ -4235,7 +4235,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
     }
 
   // Look for a target built in this directory.
-  if(cmTarget* t = this->FindTarget(name))
+  if(cmTarget* t = this->FindLocalNonAliasTarget(name))
     {
     return t;
     }
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a69c705..45f2efb 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -388,7 +388,7 @@ public:
     }
   std::vector<cmTarget*> GetImportedTargets() const;
 
-  cmTarget* FindTarget(const std::string& name) const;
+  cmTarget* FindLocalNonAliasTarget(const std::string& name) const;
 
   /** Find a target to use in place of the given name.  The target
       returned may be imported or built within the project.  */

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e1eae2a3fb5b03dca3275cc8c637286ae4ce1e2f
commit e1eae2a3fb5b03dca3275cc8c637286ae4ce1e2f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 1 09:13:16 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Apr 1 10:39:11 2016 -0400

    Fix lookup of an ALIAS target outside aliased target's directory (#16044)
    
    Refactoring in commit v3.5.0-rc1~272^2~11 (cmTarget: Implement ALIAS in
    terms of name mapping, 2015-10-25) accidentally introduced logic that
    assumes ALIAS targets always reference targets in their own directory.
    Fix this and add a test case.
    
    The configure-step fix is that `cmMakefile::FindTarget` should not consider
    aliases.  The purpose of this method is just to look up targets local to
    a directory.  Since ALIAS and normal targets share a namespace we know a
    locally defined target will never collide with an ALIAS target anyway.
    The method has 3 call sites, and this change is safe for all of them:
    
    * `cmInstallCommand::HandleTargetsMode`: Rejects aliases before the call.
    * `cmFLTKWrapUICommand::FinalPass`: Should never have considered aliases.
    * `cmMakefile::FindTargetToUse`: Falls back to a global lookup anyway.
    
    The generate-step fix is that `cmLocalGenerator::FindGeneratorTarget`
    should not consider aliases.  This method is the generate-step
    equivalent to the above.  The method has 2 call sites, and this change
    is safe for both of them:
    
    * `cmInstallTargetGenerator::Compute`: Never uses an alias target name.
    * `cmLocalGenerator::FindGeneratorTargetToUse`: Falls back to global lookup.
    
    Reported-by: Matteo Settenvini <matteo at member.fsf.org>

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 912be0c..6153fbd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -488,16 +488,6 @@ private:
 cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
     const std::string& name) const
 {
-  std::map<std::string, std::string>::const_iterator i =
-      this->AliasTargets.find(name);
-  if (i != this->AliasTargets.end())
-    {
-    std::vector<cmGeneratorTarget*>::const_iterator ai =
-        std::find_if(this->GeneratorTargets.begin(),
-                     this->GeneratorTargets.end(),
-                     NamedGeneratorTargetFinder(i->second));
-    return *ai;
-    }
   std::vector<cmGeneratorTarget*>::const_iterator ti =
       std::find_if(this->GeneratorTargets.begin(),
                    this->GeneratorTargets.end(),
@@ -506,7 +496,6 @@ cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
     {
     return *ti;
     }
-
   return 0;
 }
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 600c985..598f8c4 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4058,25 +4058,13 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const
   return this->StateSnapshot.GetDirectory().GetPropertyKeys();
 }
 
-cmTarget* cmMakefile::FindTarget(const std::string& name,
-                                 bool excludeAliases) const
+cmTarget* cmMakefile::FindTarget(const std::string& name) const
 {
-  if (!excludeAliases)
-    {
-    std::map<std::string, std::string>::const_iterator i =
-        this->AliasTargets.find(name);
-    if (i != this->AliasTargets.end())
-      {
-      cmTargets::iterator ai = this->Targets.find(i->second);
-      return &ai->second;
-      }
-    }
   cmTargets::iterator i = this->Targets.find( name );
   if ( i != this->Targets.end() )
     {
     return &i->second;
     }
-
   return 0;
 }
 
@@ -4247,7 +4235,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
     }
 
   // Look for a target built in this directory.
-  if(cmTarget* t = this->FindTarget(name, excludeAliases))
+  if(cmTarget* t = this->FindTarget(name))
     {
     return t;
     }
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 362ea75..a69c705 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -388,8 +388,7 @@ public:
     }
   std::vector<cmTarget*> GetImportedTargets() const;
 
-  cmTarget* FindTarget(const std::string& name,
-                       bool excludeAliases = false) const;
+  cmTarget* FindTarget(const std::string& name) const;
 
   /** Find a target to use in place of the given name.  The target
       returned may be imported or built within the project.  */
diff --git a/Tests/AliasTarget/subdir/CMakeLists.txt b/Tests/AliasTarget/subdir/CMakeLists.txt
index 8c84aea..bf9e768 100644
--- a/Tests/AliasTarget/subdir/CMakeLists.txt
+++ b/Tests/AliasTarget/subdir/CMakeLists.txt
@@ -1,3 +1,7 @@
 
 add_library(tgt STATIC empty.cpp)
 add_library(Sub::tgt ALIAS tgt)
+
+# foo comes from the top-level CMakeLists.txt
+add_library(Top::foo ALIAS foo)
+get_target_property(a_prop Top::foo INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list