Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.07 KB

use-it-as-a-cmake-subdirectory.md

File metadata and controls

48 lines (33 loc) · 1.07 KB
layout title nav_order has_children parent grand_parent has_toc
default
Use it as a CMake subdirectory
2
false
CMake targets
Integration
false

Use it as a CMake subdirectory

You can use Matplot++ directly in CMake projects without installing it. Check if you have Cmake 3.14+ installed:

cmake -version

Clone the whole project

git clone https://github.com/alandefreitas/matplotplusplus/

and add the subdirectory to your CMake project:

add_subdirectory(matplotplusplus)

When creating your executable, link the library to the targets you want:

add_executable(my_target main.cpp)
target_link_libraries(my_target PUBLIC matplot)

Add this header to your source files:

#include <matplot/matplot.h>

However, it's always recommended to look for Matplot++ with find_package before including it as a subdirectory. Otherwise, we can get ODR errors in larger projects.