[cmake-developers] Tools for handling cross project dependencies

Raffi Enficiaud raffi.enficiaud at mines-paris.org
Mon Oct 2 09:10:23 EDT 2017


Le 27.09.17 à 19:10, Egor Pugin a écrit :
>> The idea is to include several "packages" (one package ~ one project in Boost) and make those available to the build, exactly as for a regular CMakeLists.txt that adds several directories or subprojects through a sequence of calls to "add_directories".
>> However, the difference here is that "packages" have inter-dependencies, and the order of the "add_directories" should honor those dependencies.
>
> I solved the issue of including several dirs (via 'add_directories')
> using guards 'if (TARGET name); return(); endif()' in my pkg manager.
> See boost libraries there: https://cppan.org/search?q=boost
> Each library can be included to project separately with autoincluding
> required deps for it.

Hi,

Thank you for your answer. What you did with CPAN is wonderful, but I 
think this much more than what my humble scripts are trying to address.

Also the guard mechanism does not really address the issue of ordering 
the add_directories in some topological order. In particular, you guard 
because you do not want to declare several times the same target, but it 
does not tell when to include any other dependencies your target may have.

In summary (correct me if I am wrong) what this does is (in some pseudo 
code):

---------
if(target1, target2 ... already defined)
   return

declare target1, target2 ...
target_dependencies target1, target1.1, target1.2 ...
target_dependencies target2, target2.1, target2.2 ...
---------

but it does not tell when to declare target1.1, target1.2 ... and this 
knowledge should be encoded somewhere else in your scripts.

Best,
Raffi




More information about the cmake-developers mailing list