[CMake] link_libraries() deprecated. Why?

Marcel Loose loose at astron.nl
Wed Apr 1 17:35:22 EDT 2009


Hi all,

I was wondering why the link_libraries() command has been deprecated. Commands like include_directories() and link_directories() which have the same "scope" have not been deprecated. I think that link_libraries() has its virtues too.

My reason for asking this, is that I wonder what's the proper way to add a library to *all* targets in a project; for example, a logging library or a threads library. Here, link_libraries() provides IMHO a much cleaner solution, than target_link_libraries(). The latter requires me to keep track of the globally used library in a variable that must be passed around; and for each target I must explicitly specify its dependency on this library by using target_link_libraries().

Or, am I missing something, and is there a cleaner way to do this, without using a deprecated feature?

Best regards,
Marcel Loose.



More information about the CMake mailing list