Search code examples
cmakebuildtesseractleptonica

How can I build a project with CMake?


I've downloaded a source of leptonica-1.74.4 I need lib, dll and *.h files for using with tesseract lib. As I understood firstly I have to build this source with CMake and then I'll get VS files. (Or maybe lib and dll???) I've never work with CMake. Have no idea how to run CMakeLists or whatever through CMake. What should I do? I was trying to read documentation and it just made me confused. OS Windows 8.


Solution

  • CMake ist not a build system but manages the build process within your native build environment - in your case (Win8 + VS) it'll create the project and solution files you can use in VisualStudio.

    For your specific case it will be best to

    • Download, install and run CMake-GUI
    • Specify the source folder(where CMakeLists.txt is located)
    • Specify the build folder(where the libs / executables shall be build)
    • Press "Configure" - you will be asked for the generator you want to use - ideally you choose the VS version you have installed in your system.
    • Press "Generate" - cmake generates the .vcxproj and .sln files in your build folder corresponding to the VS version you have chosen.
    • Open the .sln file and start building leptonica or integrate the project into your own solution.

    In addition - CMake allows you to directly trigger the build with your native compiler. But this needs to be done via the console.

    more information here