[CMake] Linking to Mac OS X frameworks

Aggelos Kolaitis neoaggelos at gmail.com
Thu Apr 17 03:02:01 EDT 2014


Short: Is linking to Mac OS X frameworks with Xcode generator totally
broken, or am I just doing something wrong?

Long: I use CMake as the build system for my project[1], and I use
this [2] module to find SDL2 in the user's system. find_library() opts
for the SDL2.framework on Mac OS X, which is located (in my system) in
"/Library/Frameworks/SDL2.framework". In the cache, I can see the
following entries:

SDL2_INCLUDE_DIR: /Library/Frameworks/SDL2.framework/Headers
SDL2_LIBRARY       : /Library/Frameworks/SDL2.framework;-framework Cocoa

I can successfully generate the Xcode project, but during the build
process, I get an error that 'SDL2: framework not found'. I have
currently found two workarounds:

1). Change SDL2_LIBRARY to point to the actual SDL2 library and not
the framework:

SDL2_LIBRARY        : /Library/Frameworks/SDL2.framework/SDL2;-framework Cocoa

2). Use the makefile generator. The error only occurs with Xcode.

So what is wrong? I can't really test much more on a Mac OS X system
(because I use a friend's Macbook for testing and he's away). This is
CMake 2.8.12, downloaded from the CMake download page.

Thanks in advance,
Aggelos Kolaitis

[1]: http://bitbucket.org/sdlu/sdlu
[2]: https://bitbucket.org/sdlu/sdlu/src/c957300ede2fa1b9c4f1095359655fac806600b8/scripts/cmake/FindSDL2.cmake?at=master


More information about the CMake mailing list