[CMake] Linking against OS X Frameworks

Bill Hoffman bill.hoffman at kitware.com
Fri Aug 7 09:30:16 EDT 2009


ML wrote:
> Hi Michael,
> 
> 
> I still get the same compile errors as before. But works using Xcode for 
> me.
> 
> Is there another resource as I can't find an example of these basic 
> things on the wiki. Even Google searching is not really turning up much. 
> I did find:http://www.vtk.org/Wiki/CMake:HowToUseExistingOSXFrameworks 
> which is how I structured my first example but alas nothing. Even for 
> this list I few people replied with ideas none that seem to work.
> 
> I would appreciate pointers!
> 

Folks, CMake is framework aware.   You don't need to add the -F stuff. 
You can either use a full path to a framework in include_directories or
in target_link_libraries.   Find_library will also find frameworks.

The following will work:

find_library(CARBON NAMES Carbon)
add_executable(foo foo.cxx)
target_link_libraries(foo ${CARBON})

-Bill


More information about the CMake mailing list