cmake: support gflags in static builds