diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 460f123e96..b13e045055 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -495,17 +495,17 @@ if(ALICEVISION_BUILD_SFM) endif() endif() - if(NOT ALICEVISION_USE_OPENCV_CONTRIB STREQUAL "OFF") - find_package(OpenCV COMPONENTS mcc) - if(OpenCV_FOUND) - set(ALICEVISION_HAVE_OPENCV_CONTRIB 1) - message(STATUS "OpenCV contrib found.") - elseif(ALICEVISION_USE_OPENCV_CONTRIB STREQUAL "ON") - message(SEND_ERROR "Failed to find OpenCV.") + if(ALICEVISION_HAVE_OPENCV) + if(NOT ALICEVISION_USE_OPENCV_CONTRIB STREQUAL "OFF") + find_package(OpenCV COMPONENTS mcc) + if(OpenCV_FOUND) + set(ALICEVISION_HAVE_OPENCV_CONTRIB 1) + message(STATUS "OpenCV contrib found.") + elseif(ALICEVISION_USE_OPENCV_CONTRIB STREQUAL "ON") + message(SEND_ERROR "Failed to find OpenCV.") + endif() endif() - endif() - if(ALICEVISION_HAVE_OPENCV) include_directories(${OpenCV_INCLUDE_DIRS}) # add a definition that allows the conditional compiling if(ALICEVISION_USE_OCVSIFT)