[CMake] find zlib, tiff and jpeg libs recent versions
Sebastian Elsner
sebastian at risefx.com
Mon Jun 11 18:10:36 EDT 2012
Hello,
I have been using cmake with a project called OpenImageIO. This library
uses other libraries like zlib, tif and jpg to read images. While
configuring the build with newest cmake on windows, I noticed that cmake
would not find any of the above libraries. The full paths to the
libraries folders (with lib and include subfolders) were added correctly
to the CMAKE_PREFIX_PATH. I finally found that the issues lie with
cmake, not being up to date with the names of the .lib files. So I added
simple fixes in the .cmake files and would like to ask, if they are OK
in a way that they can be included to the official cmake distribution.
1) zlib: In newer versions of zlib, zlib.lib has been renamed to
zlibwapi.lib and thus is not found by cmake. Simple solution: add
zlibwapi to FindZLIB.cmake in line 52: SET(ZLIB_NAMES z zlib zdll zlib1
zlibd zlibd1 zlibwapi)
2) tiff: When using static versions of the tiff library, the
FindTIFF.cmake works fine. Using a shared version creates a file called
libtiff_i.lib instead of libtiff.lib. Simple solution: add libtiff_i to
FindTIFF.cmake in line 22: SET(TIFF_NAMES ${TIFF_NAMES} tiff libtiff
tiff3 libtiff3 libtiff_i)
3) jpeg: Like zlib the .lib file has been renamed in newer versions from
jpeg.lib to libjpeg.lib. So I add libjpeg to SET(JPEG_NAMES
${JPEG_NAMES} jpeg libjpeg) in line 25, FindJPEG.cmake
Is this the correct way to go?
Cheers
Sebastian
More information about the CMake
mailing list