Install as a Package via CMake
If you have CMake 3.21 or greater, you can use the system build preset to
build the package system-wide:
1 2 3 | |
Alternatively, if the CMAKE_PREFIX_PATH environment variable is set to
$HOME/.local, then you can install it locally. This can be set in /etc/profile
or your shell config. This will not affect discovery of packages installed
system-wide.
1 | |
This has the advantage of not
requiring sudo, and matplotplusplus will be installed in $HOME/.local.
1 2 3 | |
You can now use it from CMake with find_package:
1 2 3 | |
If you're using a version of CMake too old to support presets, then building with the system preset is equivilant to:
1 2 3 4 5 6 7 8 | |
While building with the local preset is equivilant to:
1 2 3 4 5 6 7 8 9 | |