Setting an empty link interface (Was: Build failed in Jenkins: kdelibs_frameworks_qt5 #1395)

Stephen Kelly steveire at gmail.com
Fri Oct 11 10:30:29 UTC 2013


KDE CI System wrote:

> [steveire] Require CMake 2.8.12.


> CMake Error in tier1/sonnet/src/core/CMakeLists.txt:
> Target "SonnetCore" has policy CMP0022 enabled, but also has old-style
> LINK_INTERFACE_LIBRARIES properties populated, but it was exported without
> the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties

These are causally related of course. I pushed a temporary fix to ECM.

 http://thread.gmane.org/gmane.comp.kde.devel.frameworks/6454
 http://quickgit.kde.org/?p=extra-cmake-modules.git&a=commit&h=ba86148cf

The problem is that in kde4_add_library the LINK_INTERFACE_LIBRARIES 
property was set to empty so that link dependencies listed in 
target_link_libraries are private by default instead of public by default.

To replace that feature of the macro, a new CMAKE_LINK_INTERFACE_LIBRARIES 
variable was added to CMake which populates the default. In ECM, we've been 
setting that to empty.

However, CMake 2.8.12 has introduced a new property called 
INTERFACE_LINK_LIBRARIES as a replacement for LINK_INTERFACE_LIBRARIES. Of 
course, only one of them can be authorative, so policy CMP0022 was 
introduced to control which is so.

By setting the KDE minimum CMake version to 2.8.12, that policy has been set 
to NEW. Part of the NEW behavior of that policy is to error on export, as I 
quoted, if the LINK_INTERFACE_LIBRARIES property is set for a target.

A solution would be to remove the set(CMAKE_LINK_INTERFACE_LIBRARIES "") 
line from ECM. That would mean that a use of 

 target_link_libraries(foo A)

will cause A to be a public dependency of foo, not a private one. To make it 
a private dependency, LINK_PRIVATE would have to be specified.

That is the best solution I see for KDE for now. The use of the LINK_PUBLIC 
and LINK_PRIVATE keywords is now common and pervasive throughout KF5, so the 
mistake of leaving them out entirely is now less likely.

Brad, can you think of any other solution to the problem of 'make the link 
interface private by default'?

Thanks,

Steve.




More information about the Kde-frameworks-devel mailing list