I had to rebuild CMocka the other day for one of my projects, and I was initially pretty confused as to why the CMocka build system was only generating dynamic libraries. The documentation didn't mention anything obvious about static libraries either.
I'm still new to CMake and wasn't aware of the
DefineOptions.cmake file, which clearly indicates the static library option. Instead I poked around and discovered the
WITH_STATIC_LIB option had to be defined in order for a static library to be generated.
For others who may also be confused, simply define the
WITH_STATIC_LIB option during the initial
cmake build step:
cmake ../ -DWITH_STATIC_LIB=true