Setting INTERFACE properties on an UNKNOWN library

Is there any particular corner case where setting an INTERFACE property on a library of type UNKNOWN shouldn’t work? Right now, we have the following situation:

add_library(blah UNKNOWN IMPORTED)

# This fails
target_link_libraries(blah INTERFACE something)

# But this succeeds
set_property(TARGET blah INTERFACE_LINK_LIBRARIES something)

My initial reaction is that I would have expected both cases to work, but maybe I’m missing something and target_link_libraries() is legitimately rejecting this for some reason.

The particular case where this came up (with bug report) was in wrapping FindOpenSSL in a project to handle static libraries (already reported in CMake’s issue tracker but not yet fixed). The FindOpenSSL module apparently doesn’t set up all the dependencies correctly on Windows.

1 Like

At one time we didn’t support using target_* commands to populate the INTERFACE_* properties of imported libraries. I suspect when that was implemented, the case of UNKNOWN libraries was simply overlooked.