Make BUILD_SHARED_LIBS=OFF actually work