Build OpenCV 5 with CMake failed

I build opencv 5 with following command but failed

cmake

-G “Visual Studio 18 2026” -A x64
-S C:/Github/opencv-5.0.0
-B C:/Github/opencv-5-build
-D CMAKE_BUILD_TYPE=RELEASE
-D BUILD_CUDA_STUBS=ON
-D BUILD_JAVA=OFF
-D BUILD_OPENCV_JAVA_BINDINGS_GENERATOR=OFF
-D BUILD_OPENCV_JS_BINDINGS_GENERATOR=OFF
-D BUILD_OPENCV_WORLD=ON
-D INSTALL_PYTHON_EXAMPLES=ON
-D OPENCV_EXTRA_MODULES_PATH=C:/Github/opencv_contrib/modules
-D OPENCV_PYTHON3_VERSION=1
-D WITH_CUDA=1
-D WITH_OPENGL=1
-D WITH_VTK=0

Can anybody help on this?

Hi Simon

Can you show us the CMake error message ?
Keep in mind that CMake is case insensitive (ex. RELEASE).
Make sure your CUDA version supports your Visual Studio compiler (check nvcc --version).

Hi Mohamed,

  1. clone OpenCV 5 from https://github.com/opencv/opencv/tree/5.0.0
    git clone https://github.com/opencv/opencv.git

  2. I used CMake-GUI from downloaded Qt
    cmake version is 3.30.5

I just input source and binaries location and click Configure
The error is listed as below

(Attachment err.txt is missing)

well, show the output? it’s text, so copy the text.