Getting ready

While we keep account.cpp unchanged, we modify the interface file from the previous recipe (account.hpp):

#pragma once  #define BOOST_PYTHON_STATIC_LIB#include <boost/python.hpp>class Account {public:  Account();  ~Account();  void deposit(const double amount);  void withdraw(const double amount);  double get_balance() const;private:  double balance;};namespace py = boost::python;BOOST_PYTHON_MODULE(account) {  py::class_<Account>("Account")      .def("deposit", &Account::deposit)      .def("withdraw", &Account::withdraw)      .def("get_balance", &Account::get_balance);}

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.