制作tdlib示例时的错误

时间:2018-03-27 11:10:11

标签: cmake

我正在尝试按照自述文件(https://github.com/tdlib/td/tree/master/example/java)为td lib构建一个java示例 我有以下误包。请告诉我该如何解决?

C:\Users\irina\td\jnibuild>cmake -DCMAKE_BUILD_TYPE=Debug -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td ..
-- Could NOT find ccache
-- Found OpenSSL: C:/OpenSSL-Win32/include optimized;C:/OpenSSL-Win32/lib/VC/ssleay32MD.lib;debug;C:/OpenSSL-Win32/lib/VC/ssleay32MDd.lib;optimized;C:/OpenSSL-Win32/lib/VC/libeay32MD.lib;debug;C:/OpenSSL-Win32/lib/VC/libeay32MDd.lib
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Warning at CMakeLists.txt:256 (message):
  Not found zlib: skip TDLib, tdactor, tdnet, tddb


CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZLIB_LIBRARY
    linked by target "tdutils" in directory C:/Users/irina/td/tdutils

-- Configuring incomplete, errors occurred!
See also "C:/Users/irina/td/jnibuild/CMakeFiles/CMakeOutput.log".
See also "C:/Users/irina/td/jnibuild/CMakeFiles/CMakeError.log".

1 个答案:

答案 0 :(得分:1)

ZLIB for Windows GnuWin32 项目的一部分(我不确定是否允许在SO上提供链接)。如我所见,CMakeLists.txt使用find_package来查找ZLIB库:

if (NOT ZLIB_FOUND)
  find_package(ZLIB)
endif()
if (NOT ZLIB_FOUND)
  message(WARNING "Not found zlib: skip TDLib, tdactor, tdnet, tddb")
  return()
endif()

find_package

中详细描述了CMAKE_MODULE_PATH命令的工作原理
  

该命令有两种搜索包的模式:“模块”模式和   “配置”模式。使用命令调用命令时,模块模式可用   以上减少的签名。 CMake搜索名为查找< package> .cmake 的文件   在MODULE后面是CMake安装。如果文件是   发现,它由CMake读取和处理。它负责找到   包,检查版本,并生成任何所需的消息。很多人发现 -   模块提供有限的或不支持版本控制;检查模块   文档。如果找不到模块且未给出FindZLIB.cmake选项   命令进入Config模式。

我在Windows机器上查看了HKLM。该模块使用以下路径: ZLIB_ROOT 和以下注册表项:

<强> “[HKEY_LOCAL_MACHINE \ SOFTWARE \的GnuWin32 \ zlib的;安装路径]”         “$ ENV {PROGRAMFILES} / zlib的

因此,据我所知,如果您使用安装程序安装 GnuWin32 ZLIB密钥将被写入注册表,CMake将能够找到{{{{ 1}}。如果您只想使用zip-archive,则在运行CMake时必须正确指定ZLIB_ROOT参数:

cmake -DZLIB_ROOT=<PATH-to-your-unpacked-zlib> -D.....