summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-01-25 18:39:26 (GMT)
committerBrad King <brad.king@kitware.com>2012-01-25 19:42:31 (GMT)
commitca39c5cdd1ca28516791e00f213d6dee2179c6df (patch)
treecf36435b8b38cf4c830390c73c263f870551e408 /Source/cmGlobalGenerator.cxx
parent731f996ce070bbba1b4913050497afa95436f2d2 (diff)
downloadCMake-ca39c5cdd1ca28516791e00f213d6dee2179c6df.zip
CMake-ca39c5cdd1ca28516791e00f213d6dee2179c6df.tar.gz
CMake-ca39c5cdd1ca28516791e00f213d6dee2179c6df.tar.bz2
Optionally allow IMPORTED targets to be globally visible
Consider the case motivating commit e01cce28 (Allow add_dependencies() on imported targets, 2010-11-19). An imported target references a file generated at build time by a custom target on which it depends. Had the file been built directly using add_library or add_executable its target name would have been visible globally. Therefore the imported target representing the file should be globally visible also. Teach the IMPORTED signature of add_(executable|library) to accept a new "GLOBAL" option to make the imported target visible globally.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 124519a..8dce053 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1666,6 +1666,11 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name)
{
return i->second;
}
+ i = this->ImportedTargets.find(name);
+ if ( i != this->ImportedTargets.end() )
+ {
+ return i->second;
+ }
}
return 0;
}
@@ -2046,10 +2051,16 @@ cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target)
return this->TargetDependencies[&target];
}
-void cmGlobalGenerator::AddTarget(cmTargets::value_type &v)
+void cmGlobalGenerator::AddTarget(cmTarget* t)
{
- assert(!v.second.IsImported());
- this->TotalTargets[v.first] = &v.second;
+ if(t->IsImported())
+ {
+ this->ImportedTargets[t->GetName()] = t;
+ }
+ else
+ {
+ this->TotalTargets[t->GetName()] = t;
+ }
}
void cmGlobalGenerator::SetExternalMakefileProjectGenerator(