Using Makefiles, a debug build is done with
-DCMAKE_BUILD_TYPE=Debug
(an alias
for this is -DWITH_DEBUG=1
). This
includes DBUG instrumentation, plus wrappers around
pthread
mutexes known as
SAFE_MUTEX
on Unix systems.
If Visual Studio or Xcode generators are used (you invoked cmake with -G "Visual Studio ..." or -G Xcode), switching to release or debug configuration is done within the IDE, or at the build time using command line switches. For example:
devenv MySQL.sln /build debug
To compile in the Valgrind headers and expose the Valgrind API
to MySQL code, enable the
WITH_VALGRIND
option. Combine this
with WITH_DEBUG
to generate a debug build that
is Valgrind-aware:
cmake .. -DWITH_DEBUG=1 -DWITH_VALGRIND=1
For MySQL 5.5 and 5.6, also enable Purify flags explicitly (this is unnecessary in 5.7 and up):
cmake .. -DWITH_DEBUG=1 -DWITH_VALGRIND=1 \
-DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify