mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 22:30:13 -06:00
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.
This commit is contained in:
@@ -29,6 +29,7 @@ bool cmAddExecutableCommand
|
||||
bool use_macbundle = false;
|
||||
bool excludeFromAll = false;
|
||||
bool importTarget = false;
|
||||
bool importGlobal = false;
|
||||
while ( s != args.end() )
|
||||
{
|
||||
if (*s == "WIN32")
|
||||
@@ -51,6 +52,11 @@ bool cmAddExecutableCommand
|
||||
++s;
|
||||
importTarget = true;
|
||||
}
|
||||
else if(importTarget && *s == "GLOBAL")
|
||||
{
|
||||
++s;
|
||||
importGlobal = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
@@ -92,7 +98,8 @@ bool cmAddExecutableCommand
|
||||
}
|
||||
|
||||
// Create the imported target.
|
||||
this->Makefile->AddImportedTarget(exename.c_str(), cmTarget::EXECUTABLE);
|
||||
this->Makefile->AddImportedTarget(exename.c_str(), cmTarget::EXECUTABLE,
|
||||
importGlobal);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user