Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a framework to CMake

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.

like image 326
Quincy Avatar asked May 25 '10 21:05

Quincy


2 Answers

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.

like image 98
choobablue Avatar answered Oct 20 '22 00:10

choobablue


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

target_link_libraries(program "-framework Cocoa")
like image 41
lbsweek Avatar answered Oct 20 '22 01:10

lbsweek