We download the latest version of OpenCV and configure our environmental variables to properly find OpenCV header files and static libraries from a general CMake script that is part of a large C++ Project (the AFTRBurner 3D Visualization Engine).
Learn how to integrate libraries/packages together with CMake...
OpenCV_DIR=C:\repos\libs\opencv-4.2.0\build\x64\vc15\lib
PATH=%PATH%;"C:\repos\libs\opencv-4.2.0\build\x64\vc15\bin"