Skip to content

Embed with CPM.cmake docs —CPM now has a CPMFindPackage() command #302

Open
@saxbophone

Description

@saxbophone

Feature category

  • enhancement - build system
  • enhancement - backends
  • enhancement - build system
  • enhancement - documentation
  • enhancement - plot categories

From the docs on embedding matplotplusplus using CPM.cmake:

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

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

in your build script to let CPM.cmake do that for you.

CPM now has an alternative command to CPMAddPackage(), one which looks for a locally installed copy of the library first, falling back to downloading and building it in-tree if it can't be found. It's called CPMFindPackage() and IIRC its arguments are identical to AddPackage's. The workaround mentioned in the docs is obsolete if FindPackage is available.

If you want to hold off on making this change in the docs until there's verified proof that it works fine, I'm planning to start trying out matplotplusplus soon myself. I've been using CPMFindPackage for over a year myself in my C++ projects no problem, I'm not expecting it to have any issues. I can let you know if it works fine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions