Embed as subdirectory
You can use Matplot++ directly in CMake projects as a subproject, without installing it. This is convenient if you are experimenting with this library for the first time or don't expect your users to have Matplot++ installed on their systems.
Check if you have Cmake 3.14+ installed:
1 |
|
Clone the whole project
1 |
|
and add the subdirectory to your CMake project:
1 |
|
When creating your executable, link the library to the targets you want:
1 2 |
|
Add this header to your source files:
1 |
|
However, in larger projects, it's always recommended to look for Matplot++ with find_package
before including it as a subdirectory to avoid ODR errors.