FindOSPRay: Enabling logic seems odd? (Effectively ignores available modules if "helper variables" are null)
Super minor, but at present, the logic to enable OSPRay seems to be shoved into FindOSPRay.cmake
, even though there's the flag Module_vtkRenderingOSPRay
.
I had tried setting -DCMAKE_PREFIX_PATH
(or rather, I guess it was implicit because I had set -DCMAKE_INSTALL_PREFIX
to install to a directory where OSPRay was already installed), but saw the following error message:
Supply OSPRAY_INSTALL_DIR or OSPRAY_BUILD_DIR to find OSPRay
Looking at the logic seems rather... odd? https://gitlab.kitware.com/vtk/vtk/blob/01e0dce5fbeee1c2befe2ab3773b217f15460eeb/CMake/FindOSPRay.cmake#L75
This basically means it'll never call find_package(ospray ...)
unless you supply OSPRAY_INSTALL_DIR
.
To illustrate, I was able to have it find OSPRay in my install prefix by giving it junk to the effective hint, setting -DOSPRAY_INSTALL_DIR=1
.
IMO, it'd be much clearer if the first conditional weren't there, and it had find_package(ospray OPTIONAL ...)
... unless it's common to have FindX.cmake
modules are supposed to error out regardless of how they're invoked?
Ran into this when investigating:
https://github.com/RobotLocomotion/drake/issues/10253
Using this commit: https://github.com/EricCousineau-TRI/vtk_ospray_build/commit/0d1e31475bf9ce9905a49bf05d8169e01dde16bc
\cc @jamiesnape