How to do it

We will start by looking at the root CMakeLists.txt file, which is coordinating the superbuild:

  1. Its preamble is unchanged with respect to the previous recipes. We start by declaring a C++11 project, we set a sensible default install prefix, build type, output directories for our targets, and layout of components in the install tree:
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)project(recipe-04  LANGUAGES CXX  VERSION 1.0.0  )# <<< General set up >>>set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_EXTENSIONS OFF)set(CMAKE_CXX_STANDARD_REQUIRED ON)if(NOT CMAKE_BUILD_TYPE)  set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)endif()message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}")message(STATUS "Project will be installed ...

Get CMake Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.