[CMake] Dependency managment

Ciccio Pasticcio dodungocorporation at gmail.com
Wed Dec 12 08:01:24 EST 2018


Hi all,
we are trying to re-design the build system of an existing complex project
using cmake.
We have a source tree such this (it is only an example to help explaining
the problem)

.
└── libs
    ├── CMakeLists.txt
    ├── libA
    │   ├── CMakeLists.txt
    │   ├── include
    │   │   └── libA.h
    │   └── source
    │       └── libA.cpp
    └── libB
        ├── CMakeLists.txt
        ├── include
        │   └── libB.h
        └── source
            └── libB.cpp

The tree contains libraries and executables and many of them have some
dependencies to be
satisfied. We wrote a CMakeLists.txt file on top of the hyerarchy which
repetitively uses the
add_directory directive to build every project under it. This solution
seems to work well
until a project needs another one to be built; in other words, we did not
find out how to deal
with dependencies. Looking at the tree above, we can compile libA but we
cannot compile libB without
installing libA because the latter needs it. What's the right and easy way
to make a target globally
available or at least available for projects on the same level?

Thanks,
Gabriele
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181212/1f7f67c6/attachment.html>


More information about the CMake mailing list