Ticket #385 (closed enhancement: fixed)
Add OS X framework build option to cmake
|Reported by:||kyngchaos||Owned by:||mloskot|
patch and new file attached. Two new cmake settings:
GEOS_ENABLE_MACOSX_FRAMEWORK -- enables the framework build. I wanted to leave the option of building a standard pair of libraries on OS X. Default ON.
GEOS_ENABLE_MACOSX_FRAMEWORK_UNIXCOMPAT -- adds my "unix compatibility" feature, that makes a standard unix bin|include|lib structure with symlinks to the corresponding framework parts available to framework-challenged unix ports. Default OFF.
The CMAKE_INSTALL_PREFIX must be set in configuration, since the default /usr/local is not appropriate for frameworks. Since CMAKE_INSTALL_PREFIX defaults from cmake itself, I wasn't sure if/how I could default it to /Library/Frameworks if the user doesn't set it.
I used builtin cmake target features for creating a framework when possible. A couple things needed some (sometimes messy) customization (don't worry, it doesn't affect other systems).
- For a framework, I changed the name of the library to all caps, "GEOS". Case shouldn't matter on most Mac systems, but a case-sensitive file system is an option on OS X (not recommended), so I post-process the headers to match.
- A framework is a single binary library, so I build the C API into the main C++ library. It's possible to do special linking to join multiple libraries into one, but I've had problems with that in the past.