How to do it

This recipe builds on top of Chapter 9, Mixed-language Projects, Recipe 5, Building C++ and Python projects using pybind11. Let us see how in detail:

First, we extend account/CMakeLists.txt. The only addition is the last directive, which specifies the install target:

install(  TARGETS    account  LIBRARY    DESTINATION account  )

And that's it! With the install target and the README.rst, MANIFEST.in, setup.py, __init__.py, and version.py files in place, we are ready to test the installation of our example code which is interfaced using pybind11:

  1. For this, create a new directory somewhere on your computer and we will test the installation there.
  2. Inside the newly created directory, we run pipenv install from a local path. Adjust the local ...

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.