How to generate an OpenCV .SO file?

  cmake, java, opencv, terminal, windows

I am new to compiling sources, forgive me if there is already a similar answer here.

I downloaded the OpenCV files from this link

I unzipped the zip, created a folder called build and inside it I applied the following command:


and the following log was presented:

CMake Error: The source directory "C:/Users/LVTLWF631/Desktop/opencv-4.5.1/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

This is another way I tried

enter image description here

And this is the log

CMake Error: The source "C:/Users/LVTLWF631/Desktop/opencv-4.5.1/modules/CMakeLists.txt" does not match the source "C:/Users/LVTLWF631/Desktop/opencv-4.5.1/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

I am trying to generate the .so file to work in linux environment. I need this file because I’m going to apply this command in java. I generated any name just to illustrate:


How can I compile the opencv source to generate the .so file using windows? Could anyone help?

Source: Windows Questions