How do I use CMake?

lital maatuk picture lital maatuk · Oct 22, 2011 · Viewed 142.5k times · Source

I am trying to use CMake in order to compile opencv.

I am reading the tutorial but can't understand what is CMakeLists files and how is it connected to the gui of CMake?

Also couldn't understand what are makefiles, are they the same is CMakeLists?

And which file is it which I in the end open with visual-studio?

Answer

Basile Starynkevitch picture Basile Starynkevitch · Oct 22, 2011

I don't know about Windows (never used it), but on a Linux system you just have to create a build directory (in the top source directory)

mkdir build-dir

go inside it

cd build-dir

then run cmake and point to the parent directory

cmake ..

and finally run make

make

Notice that make and cmake are different programs. cmake is a Makefile generator, and the make utility is governed by a Makefile textual file. See cmake & make wikipedia pages.

NB: On Windows, cmake might operate so could need to be used differently. You'll need to read the documentation (like I did for Linux)