alandefreitas / matplotplusplus

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

glad not exported when built locally #389

Open ryan0270 opened 10 months ago

ryan0270 commented 10 months ago

Bug category

Describe the bug When MATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON I get the following error during cmake configure.

CMake Error: install(EXPORT "Matplot++Targets" ...) includes target "matplot_opengl" which requires target "glad" that is not in any export set.

In my case, find_package(GLAD) does not find anything so FetchContent is used to download glad. Cmake is complaining that matplot_opengl depends on a local target, glad, that won't be installed.

I suspect the solution is to append it to the TARGETS list if built locally, but there may be some other subtleties I'm not considering.

Steps to Reproduce

# This is part on Arch Linux AUR build() step
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \
      -DBUILD_SHARED_LIBS=ON \
      -DMATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON \
      -DMATPLOTPP_BUILD_EXAMPLES=OFF \
      -DMATPLOTPP_BUILD_TESTS=OFF \

Output

```console CMake Error: install(EXPORT "Matplot++Targets" ...) includes target "matplot_opengl" which requires target "glad" that is not in any export set. ```

Platform

Environment Details:

Additional context