cmGeneratorTarget: Move IsLinkable from cmTarget.
This commit is contained in:
parent
a527abf099
commit
8e20ea6ef2
|
@ -643,7 +643,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tgt && tgt->Target->IsLinkable())
|
if(tgt && tgt->IsLinkable())
|
||||||
{
|
{
|
||||||
// This is a CMake target. Ask the target for its real name.
|
// This is a CMake target. Ask the target for its real name.
|
||||||
if(impexe && this->LoaderFlag)
|
if(impexe && this->LoaderFlag)
|
||||||
|
|
|
@ -210,7 +210,7 @@ bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
|
||||||
ImportPropertyMap &properties,
|
ImportPropertyMap &properties,
|
||||||
std::vector<std::string> &missingTargets)
|
std::vector<std::string> &missingTargets)
|
||||||
{
|
{
|
||||||
if(!target->Target->IsLinkable())
|
if(!target->IsLinkable())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,7 +1654,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
|
||||||
const GeneratorExpressionContent *content)
|
const GeneratorExpressionContent *content)
|
||||||
{
|
{
|
||||||
// The file used to link to the target (.so, .lib, .a).
|
// The file used to link to the target (.so, .lib, .a).
|
||||||
if(!target->Target->IsLinkable())
|
if(!target->IsLinkable())
|
||||||
{
|
{
|
||||||
::reportError(context, content->GetOriginalExpression(),
|
::reportError(context, content->GetOriginalExpression(),
|
||||||
"TARGET_LINKER_FILE is allowed only for libraries and "
|
"TARGET_LINKER_FILE is allowed only for libraries and "
|
||||||
|
|
|
@ -5936,3 +5936,14 @@ std::string cmGeneratorTarget::GetSupportDirectory() const
|
||||||
#endif
|
#endif
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmGeneratorTarget::IsLinkable() const
|
||||||
|
{
|
||||||
|
return (this->GetType() == cmState::STATIC_LIBRARY ||
|
||||||
|
this->GetType() == cmState::SHARED_LIBRARY ||
|
||||||
|
this->GetType() == cmState::MODULE_LIBRARY ||
|
||||||
|
this->GetType() == cmState::UNKNOWN_LIBRARY ||
|
||||||
|
this->GetType() == cmState::INTERFACE_LIBRARY ||
|
||||||
|
this->Target->IsExecutableWithExports());
|
||||||
|
}
|
||||||
|
|
|
@ -412,6 +412,9 @@ public:
|
||||||
/** Get a build-tree directory in which to place target support files. */
|
/** Get a build-tree directory in which to place target support files. */
|
||||||
std::string GetSupportDirectory() const;
|
std::string GetSupportDirectory() const;
|
||||||
|
|
||||||
|
/** Return whether this target may be used to link another target. */
|
||||||
|
bool IsLinkable() const;
|
||||||
|
|
||||||
struct SourceFileFlags
|
struct SourceFileFlags
|
||||||
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static bool VSLinkable(cmTarget const* t)
|
static bool VSLinkable(cmGeneratorTarget const* t)
|
||||||
{
|
{
|
||||||
return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY;
|
return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY;
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,8 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
|
||||||
di != utilDepends.end(); ++di)
|
di != utilDepends.end(); ++di)
|
||||||
{
|
{
|
||||||
cmTarget const* dep = *di;
|
cmTarget const* dep = *di;
|
||||||
if(allowLinkable || !VSLinkable(dep) || linked.count(dep))
|
cmGeneratorTarget* dgt = this->GetGeneratorTarget(dep);
|
||||||
|
if(allowLinkable || !VSLinkable(dgt) || linked.count(dep))
|
||||||
{
|
{
|
||||||
// Direct dependency allowed.
|
// Direct dependency allowed.
|
||||||
vsTargetDepend.insert(dep->GetName());
|
vsTargetDepend.insert(dep->GetName());
|
||||||
|
|
|
@ -344,17 +344,6 @@ bool cmTarget::IsExecutableWithExports() const
|
||||||
this->GetPropertyAsBool("ENABLE_EXPORTS"));
|
this->GetPropertyAsBool("ENABLE_EXPORTS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool cmTarget::IsLinkable() const
|
|
||||||
{
|
|
||||||
return (this->GetType() == cmState::STATIC_LIBRARY ||
|
|
||||||
this->GetType() == cmState::SHARED_LIBRARY ||
|
|
||||||
this->GetType() == cmState::MODULE_LIBRARY ||
|
|
||||||
this->GetType() == cmState::UNKNOWN_LIBRARY ||
|
|
||||||
this->GetType() == cmState::INTERFACE_LIBRARY ||
|
|
||||||
this->IsExecutableWithExports());
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmTarget::HasImportLibrary() const
|
bool cmTarget::HasImportLibrary() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -228,9 +228,6 @@ public:
|
||||||
enabled. */
|
enabled. */
|
||||||
bool IsExecutableWithExports() const;
|
bool IsExecutableWithExports() const;
|
||||||
|
|
||||||
/** Return whether this target may be used to link another target. */
|
|
||||||
bool IsLinkable() const;
|
|
||||||
|
|
||||||
/** Return whether or not the target is for a DLL platform. */
|
/** Return whether or not the target is for a DLL platform. */
|
||||||
bool IsDLLPlatform() const { return this->DLLPlatform; }
|
bool IsDLLPlatform() const { return this->DLLPlatform; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue