nvidiaOpticalFlow header missing opencv

im having an issue compiling opencv 4.1.1 system

im running a nvidia gtx1070 maxq mobile notebook model

installed cuda 10.0

cmake configuration:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_PYTHON_EXAMPLES=ON
-D INSTALL_C_EXAMPLES=ON
-D WITH_TBB=ON
-D WITH_CUDA=ON
-D BUILD_opencv_cudacodec=OFF
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUBLAS=1
-D WITH_V4L=ON
-D WITH_QT=ON
-D WITH_OPENGL=ON
-D WITH_GSTREAMER=ON
-D OPENCV_GENERATE_PKGCONFIG=ON
-D OPENCV_PC_FILE_NAME=opencv.pc
-D OPENCV_ENABLE_NONFREE=ON
-D OPENCV_PYTHON3_INSTALL_PATH=/home/tc/PyEnvs/project1_mask_rcnn/lib/python3.7/site-packages
-D OPENCV_EXTRA_MODULES_PATH=/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules
-D PYTHON_EXECUTABLE=/home/tc/PyEnvs/project1_mask_rcnn/bin/python3.7
-D CMAKE_USE_OPENSSL=ON
-D BUILD_DOCS=ON
-D BUILD_EXAMPLES=ON …

and it stops at: 76 %

[ 76%] Building CXX object modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/src/nvidiaOpticalFlow.cpp.o
In file included from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy.hpp:50:0,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/private.hpp:57,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/src/precomp.hpp:59,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp:7:
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp: In member function ‘NCVStatus HaarFeature64::setRect(Ncv32u, Ncv32u, Ncv32u, Ncv32u, Ncv32u, Ncv32u)’:
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:87:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->x = (Ncv8u)rectX;
^~
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:88:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->y = (Ncv8u)rectY;
^~
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:89:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->width = (Ncv8u)rectWidth;
^~
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:90:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
((NcvRect8u*)&(this->_ui2.x))->height = (Ncv8u)rectHeight;
^~
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp: In member function ‘void HaarFeature64::getRect(Ncv32u*, Ncv32u*, Ncv32u*, Ncv32u*)’:
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:102:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
NcvRect8u tmpRect = (NcvRect8u)(&this->_ui2.x);
^
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudalegacy/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp:102:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
In file included from /home/tc/compiele/open_cv/setup_05_11_2019/opencv-4.1.1/modules/core/include/opencv2/core.hpp:54:0,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv-4.1.1/modules/core/include/opencv2/core/cuda.hpp:51,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/include/opencv2/cudaoptflow.hpp:50,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/src/precomp.hpp:48,
from /home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp:7:
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp: At global scope:
/home/tc/compiele/open_cv/setup_05_11_2019/opencv-4.1.1/modules/core/include/opencv2/core/base.hpp:320:40: error: expected constructor, destructor, or type conversion before ‘(’ token
#define CV_Error( code, msg ) cv::error( code, msg, CV_Func, FILE, LINE )
^
/home/tc/compiele/open_cv/setup_05_11_2019/opencv_contrib-4.1.1/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp:15:1: note: in expansion of macro ‘CV_Error’
CV_Error(cv::Error::HeaderIsNull, “Nvidia Optical Flow headers not found. Make sure cmake downloads it properly”);
^
modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/build.make:993: recipe for target ‘modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/src/nvidiaOpticalFlow.cpp.o’ failed
make[2]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/src/nvidiaOpticalFlow.cpp.o] Error 1
CMakeFiles/Makefile2:16461: recipe for target ‘modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all’ failed
make[1]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all] Error 2
Makefile:162: recipe for target ‘all’ failed
make: *** [all] Error 2

does any1 have an idea how i can solve that issue?
do i need to compile nvidia optical flow sdk somehow?

isue solved by adding -D BUILD_opencv_cudaoptflow=OFF withing cmake configuration

If we did not want to just turn it off, how can this be fixed? I found the headers needed I am just not sure what directory to place them in. The two I have tried:
…\modules\cudaoptflow\include\opencv2
and
…\modules\cudaoptflow\src

Making it to 96% install because of these headers before OpenCV install stops.
I am doing a complete offline install, I had some other (bootdesc and vgg) file headers I had too find as well. Once placed in the correct directory I was able to get past the 74% I was stuck at and now I am at 96% fail because of these nvidia headers. It was more clear where the other files needed to be placed than these nvidia headers. Any thoughts are welcomed!

Fixed! Also, just turning it off did not work for me.

Headers found at:
https://github.com/NVIDIA/NVIDIAOpticalFlowSDK

Headers copied in correct directory which is:
…\opencv-4.1.1\release\3rdparty\NVIDIAOpticalFlowSDK_1_0_Headers\NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6b598a9810964c32
Had to make the last two folders. The long commit number 79… can be found in the cmake file

Fianlly, change the cmake file not to collapse the whole install just because the Nvidia headers did not download.

Cmake file at:
…\opencv_contrib-4.1.1\modules\cudaoptflow

Did this by taking out the ‘NOT’
if(NOT NVIDIA_…) -changed to- if(NVIDIA_…)