问题描述
我正在使用 QuaZip 库,它具有 zlib 依赖性.我想在 Archlinux 和 Windows 7 下编译我的 CMake 托管应用程序,我都安装了 Qt 5.3.0.
I am using QuaZip library, which has zlib dependency. I want to compile my CMake managed application under Archlinux and Windows 7, in both I have Qt 5.3.0 installed.
在 Linux 上:
我在这里阅读了如何将 zlib 添加到现有的 qt 安装",即 zlib 是 Qt 安装的本机部分.但是在 archlinux 中没有这样的目录.当然,我搜索了包括 QtCore 在内的所有其他 Qt 包含目录,但没有 zlib 的迹象.另一方面,zlib 的系统安装可以通过 FindZLIB.cmake 模块在 archlinux 上找到.
I have read here "how to add zlib to an existing qt installation" that zlib is a native part of Qt installation. But in archlinux there is no such directory. Of cause I searched through all other Qt include directories including QtCore, but there was no sign of zlib. On the other hand system installation of zlib can be found on archlinux through FindZLIB.cmake module.
在 Windows 上:
在Qt的Windows安装中,Qt的include目录下有QtZlib文件夹,所以可以包含.尽管如此,编译器总是抱怨他无法从库中链接 zlib 函数,错误日志 here.我还尝试通过 TARGET_LINK_LIBRARIES 手动设置外部 zlib 库,但没有成功.
In the Windows installation of Qt there is QtZlib folder in Qt include directory, so it can be included. Nevertheless, compiler always complain that he cannot link zlib functions from library, error log here. I've also tried to set external zlib library manually through TARGET_LINK_LIBRARIES but with no success.
有没有人有使用 CMake 在 Qt5 下链接 Zlib 的经验?
Have anybody experiance with linking Zlib under Qt5 using CMake ?
推荐答案
Qt 的 zlib 是一个内部实现细节.你不应该使用它.您需要链接您自己的 zlib 副本,就像您根本不使用 Qt 时需要的那样.
Qt's zlib is an internal implementation detail. You're not supposed to use it. You need to link your own copy of zlib, just as you would need to if you weren't using Qt at all.
这篇关于Qt 中的 zlib - QtZlib 不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!