[cmake-developers] Policy for INTERFACE_LINK_LIBRARIES
Brad King
brad.king at kitware.com
Fri Nov 30 13:22:12 EST 2012
On 11/30/2012 11:58 AM, Stephen Kelly wrote:
> add_library(picon STATIC libone.cpp)
> add_library(picoff STATIC libtwo.cpp)
> target_link_libraries(picoff LINK_INTERFACE_LIBRARIES picon)
>
> get_target_property(_res picoff LINK_INTERFACE_LIBRARIES)
> message("PROP : ${_res}")
>
> outputs this with cmake 2.8.9:
>
> PROP : picon
>
> I don't know if that's a bug, or if you mean that the IMPORTED_ variant is
> never defined by export() or install(EXPORT). I can confirm that the
> property contents are not exported for static libraries.
Correct. The property may get set but it is simply ignored.
For the tll() way of setting it I didn't explicitly exclude
STATIC libraries because I wanted to document the behavior
of that mode simply as setting the property.
>> Somehow the "link implementation" must be turned into
>> IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG> and/or the new
>> INTERFACE_LINK_LIBRARIES when exporting targets.
>
> add_library(picon STATIC libone.cpp)
> add_library(picoff STATIC libtwo.cpp)
> target_link_libraries(picoff picon)
>
> causes the IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG> of the IMPORTED picoff
> to contain picon with CMake 2.8.9, because
> cmExportFileGenerator::SetImportDetailProperties populates that with the
> link implementation in the case of static libraries.
Right. The tll() call specifies the "link implementation" which then
*becomes* the link interface when exported.
-Brad
More information about the cmake-developers
mailing list