使用CMake时,出现Could not find ZLIB
各位热心朋友,你们好!
在进行CMake . 时,出错,
--Could not find ZLIB (missing : ZLIB_INCLUDE_DIR ZLIB_LIBRARY)
已经安装ZLIB,在usr/local/zlib下有 三个目录 include、lib 、share
如何在使用CMake时,添加ZLIB_INCLUDE_DIR、ZLIB_LIBRARY信息呢
在win32版CMake时,有Add Entry 可以解决,在linux下如何解决呢~
------解决方案--------------------
export LD_LIBRARY_PATH=/usr/local/zlib/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/usr/local/zlib/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/zlib/include:$CPLUS_INCLUDE_PATH
执行上面三行命令。不过这是临时的,也就是说切换用户,或者重新登录,你还得执行。如果不想重复执行,可以修改.bashrc(个人习惯于改这个),在.bashrc 里面添加
export LD_LIBRARY_PATH="/usr/local/zlib/lib:$LD_LIBRARY_PATH"
export C_INCLUDE_PATH="/usr/local/zlib/include:$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="/usr/local/zlib/include:$CPLUS_INCLUDE_PATH"
就可以了,.bashrc在你用户目录下面。