C++ API not usable after install
Steps to reproduce
$ git clone https://gitlab.com/graphviz/graphviz
$ cd graphviz
$ git log -1
commit 88e538477fdc365f9e4fef9860132cbf44b28a26 (HEAD -> main, origin/main, origin/HEAD)
Merge: 85be1516d 1f2fb60e1
Author: Matthew Fernandez <matthew.fernandez@gmail.com>
Date: Sat Feb 19 07:08:21 2022 +0000
Merge branch 'smattr/08C6E85C-C8A0-48CB-B812-98567782EBAC' into 'main'
upgrade Pylint dependency
See merge request graphviz/graphviz!2442
$ export PREFIX=$(mktemp -d)
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -Dwith_cxx_api=ON .. && cmake --build . && cmake --build . --target install
$ echo -e "#include <graphviz/AGraph.h>\nint main(void) { return 0; }" >foo.cc
$ c++ -std=c++2a -I${PREFIX}/include -Wall -Wextra foo.cc
In file included from foo.cc:1:
/tmp/tmp.YTVIQFMuYX/include/graphviz/AGraph.h:6:10: fatal error: cgraph/cgraph.h: No such file or directory
#include <cgraph/cgraph.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
Expected Behaviour
Compilation succeeded.
Actual Behaviour
Compilation failed due to missing cgraph.h.
OS Version
$ uname -rms
Linux 4.19.0-18-amd64 x86_64
Graphviz Version
Commit 88e53847.
Additional info
This occurs because AGraph.h is including cgraph.h using its source path, rather than its path at installation. I'm not sure the best way to fix this, because the include path needs to be different depending on whether this is compilation time or post-install: <cgraph/cgraph.h>
vs <graphviz/cgraph.h>
.