Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.07 KB

cmake-with-automatic-download.md

File metadata and controls

47 lines (34 loc) · 1.07 KB
layout title nav_order has_children parent grand_parent has_toc
default
CMake with Automatic Download
3
false
CMake targets
Integration
false

CMake with Automatic Download

Check if you have Cmake 3.14+ installed:

cmake -version

Install CPM.cmake and then:

CPMAddPackage(
    NAME matplotplusplus
    GITHUB_REPOSITORY alandefreitas/matplotplusplus
    GIT_TAG origin/master # or whatever tag you want
)
# ...
target_link_libraries(my_target PUBLIC matplot)

Then 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. You can use:

option(CPM_USE_LOCAL_PACKAGES "Try `find_package` before downloading dependencies" ON)

to let CPM.cmake do that for you. Otherwise, we can get ODR errors in larger projects.