[cmake-developers] External projects & library dependencies

Brad King brad.king at kitware.com
Tue Apr 11 13:00:07 EDT 2017


On 04/11/2017 12:33 PM, Wouter Klouwen wrote:
> So in order to create a mega project I want to put all of the third
> party packages into the build system using ExternalProject_Add.
> This function does provide for targets in terms of build dependencies,
> but this isn't quite enough. I need these packages to convey information
> in the same way as was done through pkg-config files and provide
> COMPILE_OPTIONS, INCLUDE_DIRECTORIES and LINK_LIBRARIES.
> 
> All of this information is present once the ExternalProject is built as
> it would be possible to invoke pkg-config afterwards. This is of course
> too late for CMake to resolve this information at configure/build rule
> creation time.
> 
> Is there a better way of solving this other than effectively duplicating
> the information in the pkg-config files so that CMake can read it at
> generation time?

Make your outer project a "superbuild" that does not compile anything
itself but instead just uses ExternalProject_Add to build everything
else in dependency order.  That way each project won't configure until
all its dependencies are built.

-Brad



More information about the cmake-developers mailing list