[CMake] How to add dependency relations between libs and executable

Chuck Atkins chuck.atkins at kitware.com
Thu Apr 21 09:47:35 EDT 2016


> in your proj_a example, when target_link_librairies invoke Lib B directly
> which generated in another project b, how does proj_a recognize it



> I think the reason is proj_a, b, c are all the sub directories of
> project root, if no root layer, B can not be invoked in proj_a, right?
>

That's correct.  In the example I gave, while proj_a, proj_b, and proj_c
are all sub-directories of the root level, only the root level, proj_b and
proj_c CMakeLists.txt files contain a separate project(...) command, which
meas that proj_b and proj_c can be configured and used independently but
proj_a cannot and needs to be configured from the root level where the B
and C targets are, in addition to their own separate projects, both
contained in the root level project(...) where A can see them.

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160421/db6ce470/attachment.html>


More information about the CMake mailing list