The gflags project updated their CMake config last year with a
`gflags` ALIAS target. This can be used instead of the legacy
`${gflags_LIBRARIES}` and `${gflags_INCLUDE_DIRS}` variables. It also
looks cleaner.
Fixes#198
Don't rely on an internal-linkage extern "C" function having an
unmangled name. This isn't required by the ABI, and in fact is not
valid for a conforming compiler(!). Instead, allow symbolization to
produce either a mangled or an unmangled name here.
The macro NDEBUG could be automatically defined for release build on
some build environments (e.g. MSVC). If we use NDEBUG as a key to
distinguish using DCHECK as CHECK (I call this DCHECK is enabled) or
not, we cannot make DCHECK enabled for release build on such
environments.
Considering people use a program with glog for presubmit testing or
dogfooding, they should need to do release build with DCHECK enabled.
There can be a large kernel overhead involved in POSIX_FADV_DONTNEED.
There is no point in calling this per item logged, so rate limit
to at most once per 2MiB written.
With a simple test program that logs 100K items at WARNING level:
Before:
$ time strace -c -e fadvise64 log.test \
-log_dir=/dev/shm -logtofiles=true -logtostderr=false
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 12.522509 125 99957 fadvise64
------ ----------- ----------- --------- --------- ----------------
real 0m52.671s
user 0m2.194s
sys 0m44.022s
After:
$ time strace -c -e fadvise64 log.test \
-log_dir=/dev/shm -logtofiles=true -logtostderr=false
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000759 152 5 fadvise64
------ ----------- ----------- --------- --------- ----------------
real 0m4.206s
user 0m1.436s
sys 0m3.153s
Fixes issue #84
Under some circumstances like cross-compilation, the user might not want
to enable support for gflags.
This patch allows support for --without-gflags
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
This commit introduces a CMake `BUILD_TESTING` boolean option that
allows to disable unit tests. This is especially useful in superbuilds
where typically only the main library is built. By default, this option
is enabled.