The code for this recipe is available at https://github.com/dev-cafe/cmake-cookbook/tree/v1.0/chapter-03/recipe-07 and has a C++ example. The recipe is valid with CMake version 3.9 (and higher) and has been tested on GNU/Linux, macOS, and Windows. In https://github.com/dev-cafe/cmake-cookbook/tree/v1.0/chapter-03/recipe-07, we also provide a C++ example compatible with CMake 3.5.
The BLAS library offers a standardized interface for common operations involving matrices and vectors. This interface was however standardized with the Fortran language in mind. While we have shown how these libraries can be used more or less directly from C++, it may be desirable to have a higher-level interface in modern C++ programs.
The header-only Eigen library uses template programming to offer such an interface. Its matrix and vector types are intuitive to use and even...