[CMake] How to specify library dependencies?

Robert Dailey rcdailey at gmail.com
Mon Nov 24 15:10:43 EST 2008


Hi,

I need to be able to specify directories that the linker will search to be
able to find libraries it is to link against. For this, the solution I've
found is LINK_DIRECTORIES().

Next, I need to be able to specify library files that the executable will
link against. I have no idea how to do this part. This needs to be portable,
so the only logical way I can think of doing this is to use IF()
conditionals for each different compiler/platform I intend to support. For
example (pseudocode):

IF( platform is windows )
  LINK_LIBRARIES( a.lib, b.lib, c.lib )
ELSEIF( platform is linux )
  LINK_LIBRARIES( a.o, b.o, c.o )
ENDIF()

This could get really messy, so I'm not sure how you guys would typically
handle this situation. Thanks for reading.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081124/8d97d937/attachment.htm>


More information about the CMake mailing list