# Build OpenCV 5 with CMake failed

**URL:** <https://forum.opencv.org/t/build-opencv-5-with-cmake-failed/24592>\
**Category:** Uncategorized\
**Tags:** build\
**Created:** [June 17, 2026, 5:30am UTC](https://forum.opencv.org/t/build-opencv-5-with-cmake-failed/24592 "2026-06-17T05:30:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/simon1/32/14317_2.png) [@Simon1](https://forum.opencv.org/u/Simon1)\
**Post date:** [June 17, 2026, 5:30am UTC](https://forum.opencv.org/t/build-opencv-5-with-cmake-failed/24592/1 "2026-06-17T05:30:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mkhussine](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@mkhussine](https://forum.opencv.org/u/mkhussine)\
**Post date:** [June 29, 2026, 9:37pm UTC](https://forum.opencv.org/t/build-opencv-5-with-cmake-failed/24592/2 "2026-06-29T21:37:24Z")

</div>

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`).

---

<div class="post-metadata">

**Author:** ![Simon1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/simon1/32/14317_2.png) [@Simon1](https://forum.opencv.org/u/Simon1)\
**Post date:** [June 30, 2026, 8:55am UTC](https://forum.opencv.org/t/build-opencv-5-with-cmake-failed/24592/3 "2026-06-30T08:55:20Z")

</div>

Hi Mohamed,

1. clone OpenCV 5 from [https://github.com/opencv/opencv/tree/5.0.0](https://github.com/opencv/opencv/tree/5.0.0)  
git clone [https://github.com/opencv/opencv.git](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)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [July 1, 2026, 6:59am UTC](https://forum.opencv.org/t/build-opencv-5-with-cmake-failed/24592/4 "2026-07-01T06:59:12Z")

</div>

> [@Simon1](#):
>
> failed

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