如何将框架添加到 CMake [英] How to add a framework to CMake
本文介绍了如何将框架添加到 CMake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了一个需要 Cocoa 框架的小 helloworld 程序.我想知道如何在 CMake 中添加框架.我找到的所有信息都已过时.我在雪豹上有 CMake 2.8.1.
I have written a small helloworld program that needs the Cocoa framework. I'd like to know how to add a framework in CMake. All the information I have found is out-of-date. I have CMake 2.8.1 on Snow Leopard.
推荐答案
你能不能直接用 find_library
像这样:find_library(COCOA_LIBRARY Cocoa)
?
然后在你的 <中使用 ${COCOA_LIBRARY}
代码>target_link_libraries.可能将 CMAKE_FIND_FRAMEWORK
变量设置为 仅限
.
Then use ${COCOA_LIBRARY}
in your target_link_libraries
. Possibly setting the CMAKE_FIND_FRAMEWORK
variable to ONLY
.
另外,参考这篇文章:如何使用现有的OSX框架.
Also, refer to this article: How to use existing OSX frameworks.
这篇关于如何将框架添加到 CMake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文