Understanding the Build-system

CMakeLists.txt

The build system is described by the CMakeLists.txt and is composed of few projects each responsible for a specific task. Once configured, the Outer Project is responsible for driving the overall build composed of multiple project called external project. Here is the list of external project:

  • CMakeProject-src-download
  • CMakeProject-binary-download
  • CMakeProject-build
  • CMakePythonDistributions: This corresponds to the Inner Project represented below.

The flow chart represented below illustrates which external projects are included based on the configure options and describes the role of each one:

Name Description
CMakeLists See CMakeLists.txt
Download source ? If option CMakeProject_SOURCE_DIR is set, skip source download.
Download Source archive External project downloading archives from https://cmake.org/files/.
Re-use source directory Empty external project.
Build from Source ? Answer based on option BUILD_CMAKE_FROM_SOURCE
CMakeProject-binary-download External project downloading pre-built binary archives from https://cmake.org/files/.
CMakeProject-build External project building CMake from source.
Strip executables If possible, reduce wheel size stripping cmake, cpack and ctest executables
Which files to install? Answer based on option BUILD_CMAKE_FROM_SOURCE
Install prebuilt binaries Recursively glob all files and explicitly add install rules.
Install CMake project Achieved by including ${CMakeProject_BINARY_DIR}/cmake_install.cmake.