Jetson NX with jetpack4.4 or 4.6,compile opencv 4

When I was cmopiling opencv 4.2.0 or 4.1.2,the terminal show that it could not find cudnn,but the cmake have found the path to cudnn like the picture;
Could NOT find CUDNN: Found unsuitable version “…“, but required is at least “6“found /usr/local/cuda-10.2/lib64/libcudnn.so)
And it’s confusing that Opencv 4.5.0 do not have this error.
When I ignore this error and continue ;I can finish the compiling and install the opencv;I use the jtop to configure it ,shows that opencv is compiled with cuda, but when I use opencv to my program,it shows that my opencv is not compiled with cudnn and the program could not run.

how can i solve it ,help