O'Reilly logo

CMake Cookbook by Roberto Di Remigio, Radovan Bast

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required