2
votes

I am building Podofo in Windows using CMake and Visual Studio and have these 2 problems.

One is CMake cannot detect libjpeg.

CMake Warning at CMakeLists.txt:312 (FIND_PACKAGE): By not providing "FindLIBJPEG.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "LIBJPEG", but CMake did not find one.

Could not find a package configuration file provided by "LIBJPEG" with any of the following names:

LIBJPEGConfig.cmake
libjpeg-config.cmake

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

Libjpeg not found. JPEG support will be disabled

While I already set commands in build.cmd file as below:

    set LIBJPEG_DIR=D:\jpeg-9
    cmake -G "Visual Studio 10" ..\podofo-src -DCMAKE_INCLUDE_PATH="%LIBJPEG_DIR%" -DCMAKE_LIBRARY_PATH="%LIBJPEG_DIR%" -DPODOFO_BUILD_SHARED:BOOL=FALSE -DFREETYPE_LIBRARY_NAMES_DEBUG=freetype245_D -DFREETYPE_LIBRARY_NAMES_RELEASE=freetype245MT

All the LIBJPEG files are all in d:\jpeg-9, header files and lib files. Why Cmake still cannot detect LIBJPEG?

Another problem is I got error as below while running CMake.

CMake Error at CMakeLists.txt:502 (ADD_SUBDIRECTORY):
add_subdirectory given source "src" which is not an existing directory.

so I searched CMakeLists.txt and found below command:

ADD_SUBDIRECTORY(src)

What cause this error? How to avoid the error?

Thanks.

1

1 Answers

0
votes

To get CMake to find libjpeg, you want to set CMAKE_PREFIX_PATH to D:\jpeg-9 rather than either CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH. If D:\jpeg-9\libjpeg-config.cmake exists, the find_package should then pick it up.

As to your second problem, it looks like you have a corrupt source tree. ADD_SUBDIRECTORY(src) would require a directory called "src" to exist in the same folder as the CMakeLists.txt (probably the root folder?) Perhaps a fresh download / checkout would help here.