This shows how to invoke cmake from setup.py and put the generated .so-files where they belong. The initial CMakeBuild and CMakeExtension idea comes from http://www.benjack.io/2017/06/12/python-cpp-tests.html who should be credited accordingly! Basic operations --------------- 1. CMakeLists.txt defines pybind11 targets using the helper function 2. On `setup.py install|build|develop` the CMakeBuild class first instructs cmake to configure which sets the appropriate python paths. 3. It then instruct cmake to build *all* targets 4. The extensions listed in setup.py `ext_modules=` are then moved from the build directory to its final destination. Caveats -------- 1. Tested using both `setup.py develop` and `setup.py install` and seems to work, but there is not much testing done. 2. All targets are built, not just those specified in `ext_modules`. 3. Not much documentation, as is obvious :)