How to do it

These are the required steps to use Boost.Python with your C++ project:

  1. As in the previous recipe, we start by defining the minimum version, the project name, supported language, and the default build type:
# define minimum cmake versioncmake_minimum_required(VERSION 3.5 FATAL_ERROR)# project name and supported languageproject(recipe-04 LANGUAGES CXX)# require C++11set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_EXTENSIONS OFF)set(CMAKE_CXX_STANDARD_REQUIRED ON)# we default to Release build typeif(NOT CMAKE_BUILD_TYPE)  set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)endif()
  1. In this recipe, we depend on the Python and Boost libraries as well as the Python interpreter for testing. The name of the Boost.Python component ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.