Skip to content

Fix superbuild with OpenCV4

Cédric Traizet requested to merge opencv4_superbuild into develop

Summary

This merge request fixes Superbuild when OpenCV is used.

Rationale

Compiling the Superbuild with OpenCV leads to the following error :

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find OpenCV (missing: OPENCV_core_LIBRARY) (found version
  "4.1.1")

See issue #2079 (closed) for an example.

In the superbuild the OPENCV_DIR variable is set to ${SB_INSTALL_PREFIX}/share/OpenCV. However this directory does not exist in a OpenCV 4 build.

This line is not needed, as otb is able to find OTB in ${SB_INSTALL_PREFIX} (which is in the CMake search path). The FindOpenCV.cmake script will look for openCV includes in ${SB_INSTALL_PREFIX}/opencv4/opencv2 and the lib are built in ${SB_INSTALL_PREFIX}/lib.

Note that the bug does not appear on CI as the builds are executed in two parts. First the dependencies are built using the OTB_DEPENDS target and then OTB is built independently. The Superbuild is never executed entirely.

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Cédric Traizet

Merge request reports