CMake:将框架复制到 App Bundle 中 [英] CMake: Copy Frameworks into App Bundle
问题描述
在我的项目目录中,我有一些 3rd 方框架,即 SFML,当我构建我的应用程序时,我需要将它们复制到应用程序包中.有什么干净的方法可以做到这一点(也许就像 Xcode 中的复制文件构建阶段)?
In my project directory I have some 3rd party frameworks, namely SFML, that I need to copy into the app bundle when I build my app. Any clean way to do that (maybe like the Copy Files Build Phase in Xcode)?
谢谢
推荐答案
您应该查看 CMake 的 BundleUtilities 模块.
You should check out CMake's BundleUtilities module.
这里有一个 wiki 条目,其中包含一个功能正常的示例应用程序:
There's a wiki entry complete with a functioning sample app here:
https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/BundleUtilities
BundleUtilities 模块的文档在这里:
The documentation for the BundleUtilities module is here:
http://www.cmake.org/cmake/help/v2.8.8/cmake.html#module:BundleUtilities
我建议配置一个适当调用 fixup_bundle 的 CMake -P 脚本,然后使用 CMakeinstall(SCRIPT ...)"命令在安装时调用该脚本.如果您在使用此方法时遇到任何问题,或者示例或文档中有不清楚的地方,请稍后提出更具体的问题.
I recommend configuring a CMake -P script that calls fixup_bundle appropriately and then using a CMake "install(SCRIPT ...)" command to call that script at install time. Ask more specific questions later if you run into any problems with this approach, or if there's something unclear about the example or documentation.
这篇关于CMake:将框架复制到 App Bundle 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!