The Boost libraries provide a rich C++ programming infrastructure and are popular among C++ developers. We have already shown how to find the Boost libraries on our system in Chapter 3, Detecting External Libraries and Programs. Sometimes, however, the version of Boost required by your project might not be available on the system. This recipe will show how to leverage the superbuild pattern to ship your code with the confidence that a missing dependency will not stop the configuration. We will reuse the code example from Recipe 8, Detecting the Boost libraries, in Chapter 3, Detecting External Libraries and Programs, but reorganize it in the form of a superbuild. This will be the layout of the project:
.
├── CMakeLists.txt
├── external
│ └── upstream
│ ├── boost
│ │ └── CMakeLists.txt
│ └── CMakeLists.txt
└── src
├── CMakeLists.txt
└── path-info.cpp
You will notice that there are four CMakeLists.txt files in the project source tree. The following section will walk you through these.