CMake QT_LIBRARIES 二进制等效项
我想在构建后步骤中复制所需的二进制文件。该变量是否有一个版本列出了与库关联的二进制文件?像 ${QT_BINARIES}
这样的东西会列出专门针对所包含模块的文件。
I want to copy the required binary files in my post-build step. Is there a version of this variable listing the binary files associated with the libraries? Something like ${QT_BINARIES}
which would list the files specifically for the modules included.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,有一个 $(QT_LIBRARIES),它将包含您请求的那些 Qt-dll(及其依赖项)。
与变量 $(QT_BINARY_DIR) 结合使用,您可以重建二进制文件列表。例如,Windows 上的类似以下内容(从我自己的构建后 cmakefile 中删除)。
在本例中,我在最后一行使用了安装命令,但当然您可以将其替换为副本。
Yes, there is a $(QT_LIBRARIES), which will contain those Qt-dlls you requested (and their dependencies).
In combination with the variable $(QT_BINARY_DIR) you could reconstruct a list of the binaries. E.g. something like the following (stripped from my own post-build cmakefile) on Windows.
In this case I used an install-command on the last line, but certainly you could replace it with a copy.
您还应该考虑查看 CMake 的 BundleUtilities 功能,该功能可以分析共享库先决条件,复制必要的“非系统”库(甚至修复它们以在 Mac 上使用 @executable_path 引用),并使您的可执行文件准备好使用自己的库必要库的私人副本。
请参阅此处的示例: http://www.cmake.org/Wiki/BundleUtilitiesExample
它特别有用仅拉入可执行文件实际引用的 Qt 库...
执行此操作后,您将获得捆绑应用程序的“独立”副本(或在同一目录中具有共享库的可执行文件),可以安全地使用它复制的到另一台机器。
You should also consider reviewing CMake's BundleUtilities capability, which analyzes shared library prerequisites, copies in necessary "non-system" libraries (and even fixes them up to use @executable_path references on the Mac), and leaves your executable ready to roll with its own private copies of the necessary libraries.
See the example here: http://www.cmake.org/Wiki/BundleUtilitiesExample
It's especially useful for pulling in only those Qt libraries actually referenced by your executable...
After this operation, you're left with a "stand-alone" copy of your bundle app (or executable with shared libraries in the same directory) that can be safely copied to another machine.