[CMake] Building third party libraries along with normal targets

Florent Castelli florent.castelli at gmail.com
Wed Mar 29 23:01:56 EDT 2017


On 30/03/2017 04:38, Robert Dailey wrote:
> At the end of the day, I've solved the Boost problem but I have many
> other libraries I still manually build: openssl, libpng, zlib, etc.
> It's as you said, maintaining build scripts for all of these will be
> challenging but I think that's the proper way to go in my specific
> situation (multi platform). It'll be less maintenance than rebuilding
> binaries 3x per each.
>
> Do you know how to set up the boost cmake project I linked on github
> to work with superbuild? And do you prefer your superbuild execution
> to happen during cmake generate (basically cmake invokes itself for
> the superbuild) or do you prefer a separate external run, independent
> of the normal one (basically 2x cmake invocations)?
>
> Do you know of similar projects for other libraries I mentioned? Could
> hand write my own, but seems better to piggyback on someone else's
> efforts.
>
> Thanks for your feedback!

Only a few libraries are tricky to build, libpng or zlib are trivial for 
example.

A super-build is just having one big project and defining all the 
targets directly in there, using external CMake build scripts through 
add_subdirectory() for example. There is just one CMake invocation.
This is how my Boost CMake project (yes, I'm the one being it) works. As 
for the Boost dependencies, are you really using them? If you're not, 
then you don't need to build the parts of Boost using them, most are 
optional.
If you do, then you can provide Find*.cmake scripts returning targets 
you've built yourself currently. Feel free to create issues on the bug 
tracker if you need assistance with that.

I don't know on the top of my head similar projects for all libraries, 
but I know there are many people writing CMake build scripts for all 
kind of libraries, so just search on the web :)

/Florent



More information about the CMake mailing list