How to add a framework to CMake

2019-04-22 02:04发布

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.

2条回答
来,给爷笑一个
2楼-- · 2019-04-22 02:28

another solution: https://stackoverflow.com/a/18330634/2482283

target_link_libraries(program "-framework Cocoa")
查看更多
Emotional °昔
3楼-- · 2019-04-22 02:35

Can you just use find_library like this: find_library(COCOA_LIBRARY Cocoa)?

Then use ${COCOA_LIBRARY} in your target_link_libraries. Possibly setting the CMAKE_FIND_FRAMEWORK variable to ONLY.

Also, refer to this article: How to use existing OSX frameworks.

查看更多
登录 后发表回答