ENH: Export and import link interface languages
Now that languages are part of the link interface of a target we need to export/import the information. A new IMPORTED_LINK_INTERFACE_LANGUAGES property and per-config IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG> property specify the information for imported targets. The export() and install(EXPORT) commands automatically set the properties.
This commit is contained in:
parent
3621e073a8
commit
f888a0efaf
@ -152,6 +152,9 @@ cmExportFileGenerator
|
|||||||
// Add the transitive link dependencies for this configuration.
|
// Add the transitive link dependencies for this configuration.
|
||||||
if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config))
|
if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config))
|
||||||
{
|
{
|
||||||
|
this->SetImportLinkProperty(suffix, target,
|
||||||
|
"IMPORTED_LINK_INTERFACE_LANGUAGES",
|
||||||
|
iface->Languages, properties);
|
||||||
this->SetImportLinkProperty(suffix, target,
|
this->SetImportLinkProperty(suffix, target,
|
||||||
"IMPORTED_LINK_INTERFACE_LIBRARIES",
|
"IMPORTED_LINK_INTERFACE_LIBRARIES",
|
||||||
iface->Libraries, properties);
|
iface->Libraries, properties);
|
||||||
|
@ -310,6 +310,30 @@ void cmTarget::DefineProperties(cmake *cm)
|
|||||||
"If set, this property completely overrides the generic property "
|
"If set, this property completely overrides the generic property "
|
||||||
"for the named configuration.");
|
"for the named configuration.");
|
||||||
|
|
||||||
|
cm->DefineProperty
|
||||||
|
("IMPORTED_LINK_INTERFACE_LANGUAGES", cmProperty::TARGET,
|
||||||
|
"Languages compiled into an IMPORTED static library.",
|
||||||
|
"Lists languages of soure files compiled to produce a STATIC IMPORTED "
|
||||||
|
"library (such as \"C\" or \"CXX\"). "
|
||||||
|
"CMake accounts for these languages when computing how to link a "
|
||||||
|
"target to the imported library. "
|
||||||
|
"For example, when a C executable links to an imported C++ static "
|
||||||
|
"library CMake chooses the C++ linker to satisfy language runtime "
|
||||||
|
"dependencies of the static library. "
|
||||||
|
"\n"
|
||||||
|
"This property is ignored for targets that are not STATIC libraries. "
|
||||||
|
"This property is ignored for non-imported targets.");
|
||||||
|
|
||||||
|
cm->DefineProperty
|
||||||
|
("IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG>", cmProperty::TARGET,
|
||||||
|
"Per-configuration version of IMPORTED_LINK_INTERFACE_LANGUAGES.",
|
||||||
|
"This property is used when loading settings for the <CONFIG> "
|
||||||
|
"configuration of an imported target. "
|
||||||
|
"Configuration names correspond to those provided by the project "
|
||||||
|
"from which the target is imported. "
|
||||||
|
"If set, this property completely overrides the generic property "
|
||||||
|
"for the named configuration.");
|
||||||
|
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("IMPORTED_LOCATION", cmProperty::TARGET,
|
("IMPORTED_LOCATION", cmProperty::TARGET,
|
||||||
"Full path to the main file on disk for an IMPORTED target.",
|
"Full path to the main file on disk for an IMPORTED target.",
|
||||||
@ -3791,6 +3815,24 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
|
|||||||
cmSystemTools::ExpandListArgument(libs, info.LinkInterface.SharedDeps);
|
cmSystemTools::ExpandListArgument(libs, info.LinkInterface.SharedDeps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the link languages.
|
||||||
|
if(this->GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
|
{
|
||||||
|
std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES";
|
||||||
|
linkProp += suffix;
|
||||||
|
if(const char* config_libs = this->GetProperty(linkProp.c_str()))
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(config_libs,
|
||||||
|
info.LinkInterface.Languages);
|
||||||
|
}
|
||||||
|
else if(const char* libs =
|
||||||
|
this->GetProperty("IMPORTED_LINK_INTERFACE_LANGUAGES"))
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(libs,
|
||||||
|
info.LinkInterface.Languages);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user