Use "NOT BUILD_SHARED_LIBS" in CMake rather than "LINK_ALL_STATIC"