The code for this recipe is available at https://github.com/dev-cafe/cmake-cookbook/tree/v1.0/chapter-08/recipe-05 and has a C++ example. The recipe is valid with CMake version 3.6 (and higher) and has been tested on GNU/Linux, macOS, and Windows.
ExternalProject and FetchContent are two very powerful tools in your CMake arsenal. The previous recipes should have convinced you how versatile the superbuild approach is in managing projects with complex dependencies. We have so far shown how to use ExternalProject to handle the following:
- Sources stored within your source tree
- Sources retrieved from archives available on online servers
The previous recipe showed how to use FetchContent to handle dependencies available from open source Git repositories. This recipe will show how to use ExternalProject to the same effect. This last recipe will...