diff options
author | Brad King <brad.king@kitware.com> | 2012-01-25 18:39:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-01-25 19:42:31 (GMT) |
commit | ca39c5cdd1ca28516791e00f213d6dee2179c6df (patch) | |
tree | cf36435b8b38cf4c830390c73c263f870551e408 /Source/cmAddLibraryCommand.cxx | |
parent | 731f996ce070bbba1b4913050497afa95436f2d2 (diff) | |
download | CMake-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/cmAddLibraryCommand.cxx')
-rw-r--r-- | Source/cmAddLibraryCommand.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index efa29e6..9a776fb 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -31,6 +31,7 @@ bool cmAddLibraryCommand } bool excludeFromAll = false; bool importTarget = false; + bool importGlobal = false; std::vector<std::string>::const_iterator s = args.begin(); @@ -79,6 +80,11 @@ bool cmAddLibraryCommand ++s; importTarget = true; } + else if(importTarget && *s == "GLOBAL") + { + ++s; + importGlobal = true; + } else { break; @@ -124,7 +130,7 @@ bool cmAddLibraryCommand } // Create the imported target. - this->Makefile->AddImportedTarget(libName.c_str(), type); + this->Makefile->AddImportedTarget(libName.c_str(), type, importGlobal); return true; } |