alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.34k stars 334 forks source link

I cannot link it with other libraries in CMake #320

Open notdanhan opened 1 year ago

notdanhan commented 1 year ago

Bug category

Describe the bug

I am trying to use matplot++ to create a graph for a college assignment I followed the instructions provided in the readme to perform a system-wide install via cmake

I then tried using the snippet provided to find and link the library but it produced the following output

CMake Error at /usr/local/lib64/cmake/Matplot++/Matplot++Config.cmake:47 (include):
  include could not find requested file:

    /usr/local/lib64/cmake/Matplot++/Matplot++Targets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)

Steps to Reproduce

git clone the latest version of matplotplusplus make a system-wide install following the cmake instructions try link it in a project

Platform

Environment Details:

AxelFrotscher commented 1 year ago

I experience the same bug, when trying to do a local package install. I also noticed that during install the file in question is not generated:

[username@linux matplotplusplus]$ cmake --install build/local -- Install configuration: "Release" -- Installing: /my/path/.local/lib64/Matplot++/libnodesoup.a -- Installing: /my/path/.local/lib64/cmake/Matplot++/Matplot++ConfigVersion.cmake -- Installing: /my/path/.local/lib64/cmake/Matplot++/Matplot++Config.cmake

daizhirui commented 1 year ago
cmake -DBUILD_INSTALLER=ON ..

can fix the problem temporarily.

alandefreitas commented 1 year ago

That's interesting. This option

https://github.com/alandefreitas/matplotplusplus/blob/2a8eada7d508a5ed158598888d38a54fe311c934/CMakeLists.txt#L38

should be ON by default and then trigger the installer

https://github.com/alandefreitas/matplotplusplus/blob/2a8eada7d508a5ed158598888d38a54fe311c934/CMakeLists.txt#L120

Even if it's OFF, then it shouldn't install Matplot++Config.cmake at all, and not Matplot++Config.cmake with no Matplot++Targets.cmake.

daizhirui commented 1 year ago

In the latest commit, this is already fixed. The solution I propose is for the commit when this issue is opened.