I'm using emscripten 1.38.12 to build an application that uses freetype. I can link in a pre-built freetype by specifying
-s USE_FREETYPE=1
but I still need to add a include_directories(${MYFREETYPE_DIR}) to reference my own copy of the freetype header files to resolve ft2build.h.
What is the proper way to tell cmake to use the freetype header files provided with the freetype emscripten port?
Bonus - where is the -s USE_FREETYPE=1 documented?
The solution is to add
add_compile_options("-s" "USE_FREETYPE=1")
to the CMakeLists.txt file so the emcc command will see the option and add the include directive to the freetype port header files.In my case I tried adding this directive but it was after my include_directories() line so it was not getting applied. Moving the add_compile_options directive to the top of my CMakeLists.txt file solved my problem.
The list of available ports can be found via command line:
emcc --show-ports
. The source for the ports is athttps://github.com/emscripten-ports