Change the install prefix of cMake (it’s useful because if you want to compile many version of OpenCV source code you can keep separate)

Set the Qt5 library (You must after install QtCreator). They would be in a similar path: “/Qt5.7.0/5.7/gcc_64/lib/cmake/Qt5Widgets”

OPTIONAL: you can set the extra modules path of OpenCV like opencv_contrib_modules that contain the SIFT, SURF implementation. Before you must download it from GitHub (pay attention about downloading the correct version of extra modules, the one that matches with the version of your openCV. Please check this page)

Remove from the BUILD group: BUILD_opencv_aruco, BUILD_opencv_optflow and BUILD_opencv_python2

Click on Configure button

Click on Generate button

Using the terminal enter in the build folder (with cd commands) and launch a make command ($ make)

After a long time and if you don’t have any error you can launch the make install ($ make install).