After using CMake to build opencv 4.5.2 (MinGW Makefiles) the lib folder is empty

I didn’t change any of the CMake options when I clicked generate and the only thing I did change was line 236 of OpenCVDownload.cmake because it couldn’t extract
/.cache/ade/b624b995ec9c439cbc2e9e6ee940d3a2-v0.1.1f.zip
after generating it I setup the CMakeLists.txt in CLion

cmake_minimum_required(VERSION 3.17)
project(opencvtest)

set(CMAKE_CXX_STANDARD 14)
set(OpenCV_STATIC_LIBRARIES TRUE)
set(OpenCV_DIR "E:/CPP/OPENCV/opencv/build")

find_package( OpenCV REQUIRED )
add_executable(opencvtest main.cpp)
include_directories( ${OpenCV_INCLUDE_DIRS} )
target_link_libraries( opencvtest ${OpenCV_LIBS} )
MESSAGE("OpenCV_LIBS: " ${OpenCV_LIBS} ) 
MESSAGE("OpenCV_Include: " ${OpenCV_INCLUDE_DIRS} )

The CMakeLists.txt finishes running without error but when I run main.cpp (just a demo from the opencv docs)
I get the no rule to make target ‘E:/CPP/OPENCV/opencv/build/lib/libopencv_gapi452.dll.a’ error (because the lib folder is empty)
I have tried building opencv twice but the lib folder has still come up empty.

this will only generate makefiles, it won’t compile and link libraries, you need to invoke

 mingw32-make install

from your build folder. this will build & install the opencv libs & headers to build\install

like it or not, you need a network connection, while running cmake here, it tries to download a couple of things.

it could not build the opencv_gapi module, because the ade dependancy was missing. either get the download working, or you have to disable the gapi module by unchecking BUILD_opencv_gapi and WITH_ADE in cmake-gui

so again, before you can compile your program, you have to see, that the libs were built correctly

then, this:

should be:

set(OpenCV_DIR "E:/CPP/OPENCV/opencv/build/install")

also:

set(OpenCV_STATIC_LIBRARIES TRUE)

assumes, you actually build static opencv libs , which would require unchecking

BUILD_SHARED_LIBS

in cmake before, when building the libs.

tl:dr;

please revert your changes, make sure you’re online, rerun cmake-gui and show us the output