problem setting the WITH_CUDA=ON flag using cmake

I’m working with Jetson TK1, on ubuntu 14.04, openCV 2.4.9.

I’ m getting an error:

OpenCV Error: No GPU support (The library is compiled without CUDA support) in EmptyFuncTable::mallocPitch, file C:\buildslave64\win64_amdocl\2_4_PackSlave-win32-vc11-shared\opencv\modules\dynamicuda\include\opencv2/dynamicuda/dynamicuda.hpp, line 126
Error: C:\buildslave64\win64_amdocl\2_4_PackSlave-win32-vc11-shared\opencv\modules\dynamicuda\include\opencv2/dynamicuda/dynamicuda.hpp:126: error: (-216) The l
ibrary is compiled without CUDA support in function EmptyFuncTable::mallocPitch

I tried setting the WITH_CUDA=ON flag, but it didn’t worked.
Can you please suggest me any solution; or if i am setting the flag in a wrong way, how to set the WITH_CUDA=ON flag.

I recommend asking this question on the Jetson forum:

https://devtalk.nvidia.com/default/board/162/jetson-tk1/

Jetson should have an option to use prebuilt OpenCV images:

https://elinux.org/Jetson/Installing_OpenCV