The following is a breakdown of the commands in CMakeLists.txt:
- First, we need to define the project and detect the Python interpreter, as follows:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-03 LANGUAGES CXX)set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_EXTENSIONS OFF)set(CMAKE_CXX_STANDARD_REQUIRED ON)find_package(PythonInterp QUIET REQUIRED)
- We decided to place the to-be-generated code under ${CMAKE_CURRENT_BINARY_DIR}/generated, and we need to instruct CMake to create this directory:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
- The Python script expects an upper bound for the prime numbers, and, with the following command, we can set a default:
set(MAX_NUMBER "100" CACHE STRING "Upper bound ...