CMake [supports Matlab](https://cmake.org/cmake/help/v3.10/module/FindMatlab.html#command:matlab_add_mex) to build mex files. This could allow us to make the building process more robust.