2

I already tried the pre-compiled Leptonica binary link but I read here that I have to build this from source only. So I tried building Leptonica from source.

I downloaded the source code of Leptonica from this [link].(https://github.com/tesseract-ocr/tesseract) Then I tried to build this code using CMake. To build I used CMake GUI. In source-code path I gave where CMakeLists.txt is located and in cross compiling option I gave this scripts\buildsystems\vcpkg.cmake from this link.

But I am getting this error

CMake Error at C:/vcpkg/scripts/buildsystems/vcpkg.cmake:247 (_find_package):
Could not find a package configuration file provided by "Leptonica" (requested version 1.74) with any of the following names:

    LeptonicaConfig.cmake
    leptonica-config.cmake

Add the installation prefix of "Leptonica" to CMAKE_PREFIX_PATH or set
"Leptonica_DIR" to a directory containing one of the above files.
If "Leptonica" provides a separate development package or SDK,
be sure it has been installed.

For this I build leptonica separately and generated this LeptonicaConfig.cmake file as asked in this error. But now I have to change the CMakeLists.txt and set Leptonica_DIR to the directory where my this LeptonicaConfig.cmake located. I don't know how to do this I tried adding this line in cmakelists file set(Leptonica_DIR="C:\Leptonica"). But this doesn't work, may be this is wrong.

I am really stuck, I am using tesseract4.0 and Leptonica 17.6 and really new to this building process.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
Muskan Agarwal
  • 378
  • 5
  • 19
  • 1
    Use of vcpkg, open source packager, will make the installation super easy. – seccpur Sep 07 '18 at 09:42
  • 1
    If you want to set `Leptonica_DIR` variable, set it in the GUI. Note, that variable should point to the directory, which *directly* contains `LeptonicaConfig.cmake` file. Alternatively, you may add installation prefix of "Leptonica" to CMAKE_PREFIX_PATH variable, as the error message suggests. This also could be done in CMake GUI. – Tsyvarev Sep 07 '18 at 10:22
  • According to the [CMakeLists.txt](https://github.com/DanBloomberg/leptonica/blob/master/CMakeLists.txt), if you have **installed** `leptonica`, then the `LeptonicaConfig.cmake` ends up under `[path-to-root-install-dir-of-your-choice]/leptonica/cmake/`. – compor Sep 08 '18 at 21:18
  • Thanks a lot now I am using this, it works https://github.com/Microsoft/vcpkg.git – Muskan Agarwal Sep 09 '18 at 22:32

0 Answers0