I'm trying to build an application via cmake 3.9.0. Cmake keeps complaining about the inability to find the tiff library: CMake error at CMakeModules/FindPackageHandleStandardArgs.cmake:51 (Message): Could not find REQUIRED package TIFF)
. I tried to install the library via sudo apt-get install libtiff5-dev
but was still getting the same message. Then I checked-out the source code for libtiff 4 and built it from the source. Now I think we can hint the cmake with the location where to look for the libtiff via setting the variables TIFF_INCLUDE_DIR, TIFF_INCLUDE_DIRS, etc as described here: https://cmake.org/cmake/help/v3.6/module/FindTIFF.html. However I have failed in wiring the right values for the variables. Can somebody show me an example of sample libtiff instalation and the sample values for the configuration variable in order cmake would find the TIFF. Or is here another option how to show CMake where does the TIFF library lie?
Asked
Active
Viewed 9,376 times
8

TechCrap
- 930
- 3
- 14
- 28
2 Answers
8
cd build
cmake -DTIFF_INCLUDE_DIR=<dir> -DTIFF_LIBRARY=<filename> -GNinja ..
cmake --build .
Alternatively, you can modify the variables in your CMakeLists.txt
before calling find_package()
:
set(TIFF_INCLUDE_DIR "<dir>")
set(TIFF_LIBRARY "<filename>")
find_package(TIFF)
add_executable(myexe TIFF::TIFF)
where <dir>
is the include directory path and <filename>
is the exact file path to the library.

utopia
- 1,477
- 8
- 7
-
2Thanks for the answer. So I check out the source code. The _INCLUDE_DIR is the folder with the headers in the source code folder. Correct? And the TIFF_LIBRARY is the output .so or .a file? – TechCrap Aug 03 '17 at 10:10
-
1@SimeonKredatus exactly. – utopia Aug 03 '17 at 11:44
1
To install the 'TIFF' library on a Linux system that uses the yum package manager, such as CentOS or RHEL, you can use the following command:
sudo yum install libtiff-devel

Brndn
- 676
- 1
- 7
- 21