[CMake] Static Libraries and target_link_libraries

Andrew Bell andrew.bell.ia at gmail.com
Fri Jan 25 09:45:40 EST 2019


When creating a static library, you can still use the function
"target_link_libraries" even though the static library is never linked, as
such.  What you're doing is creating a dependency record for cmake so that
target_link_libraries of a static library are included in a link of some
other target which depends on the static library.  What seems confusing is
that target_link_libraries accepts the keywords PUBLIC and PRIVATE as well
as INTERFACE when used with a static library, since only INTERFACE really
makes sense in this context.

Would it be beneficial to issue a warning when someone uses PUBLIC or
PRIVATE with target_link_libraries on a static library to make it clear
that they may not be understanding what's going on?

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190125/a9f101c1/attachment.html>


More information about the CMake mailing list