Freetype provides a Makefile with a configure utility that makes it fairly easy to cross-compile for other platforms, however there are a lot of examples on the web (as well as some solutions) of people having difficulty in it.
My intention is to cross-compile FreeType using the Android NDK into a static library that can ultimately be used by libRocket for font rendering in HTML+CSS based UIs in OpenGL applications. I’m using the CMake build system for cross-platform builds and the android-cmake project to create a CMake toolchain for the NDK. This requires creating a CMakeLists.txt for FreeType as it doesn’t currently provide one.
The CMakeLists.txt file included below is based on the FreeType-2.4.8 release and is a result of converting the Jamfile and Makefile to CMake. Its intention is simply to allow compilation with CMake. For standard build and installs I would recommend following the instructions in the docs/INSTALL file from the FreeType directory. Note: This file will try and build *all* of FreeType2′s modules as defined in include/freetype/config/ftmodule.h. If you don’t want to build some of these modules please edit that file and remove the macro calls. Continue reading