Building OpenCV from Source Using CMake

Hi,
I am trying to install OpenCV to use it in my c++ program from terminal. I am using Ubuntu WSL.

In the link below, there is the guide of how installing OpenCV from source.
https://docs.opencv.org/4.5.5/d0/d3d/tutorial_general_install.html

I haven’t used CMake before, and I am stuck in step 2.(step 2 is the line below)
CMake -G

I don’t know what should I write instead of and .

I have an OpenCV directory with its file after cloning by running line below
git clone GitHub - opencv/opencv: Open Source Computer Vision Library

I have also checked other website, but it was more confusing, since every website gives a specific solution.

Thank you in advance.

to build the libraries in WSL, stick with Unix Makefiles

I built on wsl the other day. If you don’t specify a generator then it should default to

CMake generator: Unix Makefiles

If you want a faster build then use -GNinja or -G"Ninja Multi-Config" if your not building the CUDA modules. If you want FFmpeg make sure you install pkg-config before installing FFmpeg libs if you want them to be automatically picked up.

In WSL you do not need the -G as it will use the default. Use -G if you want to use different “make” system.