Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to point cmake to zlib include path?

Or any include directory/library.

I use cmake gui tool so I run it and usually the gui will highlight the include or library it can't find and let you open a open dialog to set the path however it doesn't do that for this cmake cofig it tell you in red text in the output in the gui tool, so,

CMake Error at C:/Program Files/CMake/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.0/Modules/FindZLIB.cmake:101 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/CMakeLists.txt:7 (find_package)

So still using the gui how do I point cmake to the zlib include dir?

like image 470
graham Avatar asked Jul 17 '14 15:07

graham


2 Answers

Quick solution: apt-get install zlib1g-dev

like image 87
radu Avatar answered Nov 20 '22 22:11

radu


I'll first assume you have ZLib installed somewhere, and my guess is that it's in a non-standard location since CMake find it. If that's true, you can set the location in CMake-gui. You'll need to first click the 'Advanced' checkbox near the top, because the FindZLIB.cmake file has the following line "mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)".

Now you should be able to see the ZLIB_LIBRARY ZLIB_INCLUDE_DIR options and set the correct path.

like image 19
StAlphonzo Avatar answered Nov 20 '22 23:11

StAlphonzo