[CMake] Newbie question: TARGET_LINK_LIBRARIES vs. ADD_DEPENDENCIES

James Bigler bigler at cs.utah.edu
Tue Aug 7 09:15:24 EDT 2007


Christian Convey wrote:
> I've got two subprojects: A library FOO, and a program BAR.
> 
> If I have this:
> ADD_EXECUTABLE(BAR main.cpp)
> TARGET_LINK_LIBRARIES(BAR FOO)
> 
> 
> Then does CMake somehow realize that it needs to build its FOO library
> before trying to link the BAR program?

Yes.  TARGET_LINK_LIBRARIES will generate a dependency for you.

> Or do I need to explicitly tell it to do this, using a command such as
> the following?
> ADD_DEPENDENCIES(FOO BAR)
James












More information about the CMake mailing list