问题描述
在我的项目目录中,我有一些第 3 方框架,即 SFML,我需要在构建应用程序时将其复制到应用程序包中.有什么干净的方法可以做到这一点(可能像 Xcode 中的 Copy Files Build Phase)?
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 脚本,然后使用 CMake "install(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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!