Use paths relative to the install directory for Doxygen
This allows to set the install prefix after the project is configured. Consider a project built in the following way:
# generate a configuration in a directory named `build`
cmake . -B build/
# start the actual build
cmake --build build/
The installation prefix CMAKE_INTALL_PREFX
is set automatically in the cache and used for absolute installation paths during configuration. However, if the installation prefix is later changed, absolute paths will be wrong and the following command will fail without sudo:
# install project in build into the path `$PWD/my-dune-install`
cmake --install build/ --prefix $PWD/my-dune-install # ERROR: require sudo to install doxygen documentation in '/usr/doc'.
This is the recommended practice in the CMake documentation (see https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html), precisely due to this problem.
Edited by Santiago Ospina De Los Ríos