Check out Hunter package manager:


From: CMake <> On Behalf Of Saad Khattak
Sent: Friday, April 13, 2018 02:06
To: Cmake Mailing List <>
Subject: [Digital Signature Failure] [CMake] FetchContent and multiple CMake 


I have many independent CMake projects and most projects have external 
dependencies. Most of the projects have the same dependency e.g. Catch testing 

Each library uses FetchContent so that it can be built independently by simply 
cloning its github repository, configuring and generating through CMake and 
then building. However, I would also like the ability for these projects to 
share the same dependency to save disk space (and compile time) if they detect 
that another project already has done FetchContent on a particular dependency.

Again, note that all projects are independent where their own repositories.

------------------------------------------ EXAMPLE 
To illustrate the setup: I have LibA, LibB, LibC, LibD, LibE etc. where each 
may have a dependency that is found to be the same. So, when LibA is the only 
one that is cloned, it uses FetchContent to clone the dependencies, build them, 
install them and the test executable linked to the dependencies properly.

Now LibB is cloned and it has some dependencies that LibA doesn't have but 
other dependencies that LibA 'does' use. Assuming LibA is already built 
successfully, I would like LibB to rely on LibA's dependencies, if found, 
otherwise LibB clones, generates and builds its own dependencies.

It is also possible that LibA was never cloned/built and thus LibB must 
clone/generate/build all dependencies.
------------------------------------------ END EXAMPLE 

To solve this issue, I am using a combination of find_package(...) and 
FetchContent, however the whole setup is starting to show cracks, is fragile 
and difficult to test and maintain. So now I am wondering whether there is a 
better way to about solving the issue.

Thank you,

Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe:

Reply via email to