[CMake] Adding .lib dependencies

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jul 26 16:02:46 EDT 2010


On Thursday 15 July 2010, Chris Robison wrote:
> I'm trying to create a project that embeds mono. I'm using Visual Studio
> 2010. In VS, I would normally go to Project -> Properties -> Linker ->
> Input and adjust the Additional Dependencies list. How do you add items to
> this list in CMake? I've been playing around with add_library and
> target_link_libraries but I haven't had much success.

If I understand correctly, this should be target_link_libraries().
You use it either with libraries built in the same project using 
add_library(foo ....), then you use just the target name ("foo") in 
target_link_libraries(), or with already existing libraries, which you should 
search before using find_library(FOO_LIBRARY ...), which gives you the full 
path to the library in FOO_LIBRRARY, which you then use in 
target_link_libraries().

Alex


More information about the CMake mailing list