diff --git a/CMakeLists.txt b/CMakeLists.txt index f73c8c872b..4af166dded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -656,7 +656,9 @@ if(WITH_MATLAB) include(cmake/OpenCVFindMatlab.cmake) endif() -include(cmake/OpenCVDetectVTK.cmake) +if(WITH_VTK) + include(cmake/OpenCVDetectVTK.cmake) +endif() if(WITH_OPENVX) include(cmake/FindOpenVX.cmake) diff --git a/cmake/OpenCVDetectVTK.cmake b/cmake/OpenCVDetectVTK.cmake index cf4eb2b4cd..74f075ed9c 100644 --- a/cmake/OpenCVDetectVTK.cmake +++ b/cmake/OpenCVDetectVTK.cmake @@ -1,7 +1,3 @@ -if(NOT WITH_VTK) - return() -endif() - # VTK 6.x components find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE) IF(VTK_FOUND) diff --git a/modules/viz/CMakeLists.txt b/modules/viz/CMakeLists.txt index a5468c5bba..3575a0cb6e 100644 --- a/modules/viz/CMakeLists.txt +++ b/modules/viz/CMakeLists.txt @@ -1,4 +1,4 @@ -if(NOT WITH_VTK OR NOT DEFINED HAVE_VTK OR NOT HAVE_VTK) +if(NOT HAVE_VTK) ocv_module_disable(viz) endif()