From 7dbfdddf33ab2d52e471c8533897bc2d7aeb40c9 Mon Sep 17 00:00:00 2001
From: Andrey Pokrovskiy <wonder.mice@gmail.com>
Date: Wed, 20 Jan 2016 18:29:58 -0800
Subject: cmExportInstallFileGenerator: Fix crash in FindNamespaces

Refactoring merged by commit 9afbb733ec (Merge topic
'use-generator-target', 2015-10-20) in and around commit 381e7afd
(cmExportSet: Store a cmGeneratorTarget, 2015-10-17) forgot to update
one place in this method.  This leads to a crash in code such as

  add_library(A a.c)
  add_library(B b.c)
  target_link_libraries(B A)
  install(TARGETS B DESTINATION lib EXPORT ExpB)
  install(EXPORT ExpB DESTINATION lib/cmake/test)
  add_executable(C c.c)
  install(TARGETS C DESTINATION bin EXPORT ExpC)

Fix the target name reference to avoid using an unpopulated Target
pointer.
---
 Source/cmExportInstallFileGenerator.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index b695904..71418e8 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -496,7 +496,7 @@ cmExportInstallFileGenerator
     bool containsTarget = false;
     for(unsigned int i=0; i<targets->size(); i++)
       {
-      if (name == (*targets)[i]->Target->GetName())
+      if (name == (*targets)[i]->TargetName)
         {
         containsTarget = true;
         break;
-- 
cgit v0.12