2.9.4 MySQL Source-Configuration Options

The CMake program provides a great deal of control over how you configure a MySQL source distribution. Typically, you do this using options on the CMake command line. For information about options supported by CMake, run either of these commands in the top-level source directory:

shell> cmake . -LH
shell> ccmake .

You can also affect CMake using certain environment variables. See Section 2.12, “Environment Variables”.

The following table shows the available CMake options. In the Default column, PREFIX stands for the value of the CMAKE_INSTALL_PREFIX option, which specifies the installation base directory. This value is used as the parent location for several of the installation subdirectories.

Table 2.14 MySQL Source-Configuration Option Reference (CMake)

FormatsDescriptionDefaultIntroducedRemoved
BUILD_CONFIG Use same build options as official releases   
CMAKE_BUILD_TYPE Type of build to produce RelWithDebInfo  
CMAKE_C_FLAGS Flags for C Compiler   
CMAKE_CXX_FLAGS Flags for C++ Compiler   
CMAKE_INSTALL_PREFIX Installation base directory /usr/local/mysql  
COMPILATION_COMMENT Comment about compilation environment   
CPACK_MONOLITHIC_INSTALL Whether package build produces single file OFF  
DEFAULT_CHARSET The default server character set latin1  
DEFAULT_COLLATION The default server collation latin1_swedish_ci  
ENABLE_DEBUG_SYNC Whether to enable Debug Sync support ON  
ENABLE_DOWNLOADS Whether to download optional files OFF  
ENABLE_DTRACE Whether to include DTrace support   
ENABLE_GCOV Whether to include gcov support 5.6.3 
ENABLE_GPROF Enable gprof (optimized Linux builds only) OFF5.6.6 
ENABLED_LOCAL_INFILE Whether to enable LOCAL for LOAD DATA INFILE OFF  
ENABLED_PROFILING Whether to enable query profiling code ON  
IGNORE_AIO_CHECK With -DBUILD_CONFIG=mysql_release, ignore libaio check OFF5.6.1 
INNODB_PAGE_ATOMIC_REF_COUNT Enable or disable atomic page reference counting ON5.6.16 
INSTALL_BINDIR User executables directory PREFIX/bin  
INSTALL_DOCDIR Documentation directory PREFIX/docs  
INSTALL_DOCREADMEDIR README file directory PREFIX  
INSTALL_INCLUDEDIR Header file directory PREFIX/include  
INSTALL_INFODIR Info file directory PREFIX/docs  
INSTALL_LAYOUT Select predefined installation layout STANDALONE  
INSTALL_LIBDIR Library file directory PREFIX/lib  
INSTALL_MANDIR Manual page directory PREFIX/man  
INSTALL_MYSQLSHAREDIR Shared data directory PREFIX/share  
INSTALL_MYSQLTESTDIR mysql-test directory PREFIX/mysql-test  
INSTALL_PLUGINDIR Plugin directory PREFIX/lib/plugin  
INSTALL_SBINDIR Server executable directory PREFIX/bin  
INSTALL_SCRIPTDIR Scripts directory PREFIX/scripts  
INSTALL_SHAREDIR aclocal/mysql.m4 installation directory PREFIX/share  
INSTALL_SQLBENCHDIR sql-bench directory PREFIX  
INSTALL_SUPPORTFILESDIR Extra support files directory PREFIX/support-files  
MEMCACHED_HOME Path to memcached [none]  
MYSQL_DATADIR Data directory   
MYSQL_MAINTAINER_MODE Whether to enable MySQL maintainer-specific development environment OFF  
MYSQL_PROJECT_NAME Windows/Mac OS X project name 33065.6.5 
MYSQL_TCP_PORT TCP/IP port number 3306  
MYSQL_UNIX_ADDR Unix socket file /tmp/mysql.sock  
ODBC_INCLUDES ODBC includes directory   
ODBC_LIB_DIR ODBC library directory   
OPTIMIZER_TRACE Whether to support optimizer tracing 5.6.3 
SUNPRO_CXX_LIBRARY Client link library on Solaris 10+ 5.6.20 
SYSCONFDIR Option file directory   
TMPDIR tmpdir default value 5.6.16 
WITH_ASAN Enable AddressSanitizer OFF5.6.15 
WITH_BUNDLED_LIBEVENT Use bundled libevent when building ndbmemcache ON  
WITH_BUNDLED_MEMCACHED Use bundled memcached when building ndbmemcache ON  
WITH_CLASSPATH Classpath to use when building MySQL Cluster Connector for Java. Default is an empty string.   
WITH_DEBUG Whether to include debugging support OFF  
WITH_DEFAULT_COMPILER_OPTIONS Whether to use default compiler options ON5.6.6 
WITH_DEFAULT_FEATURE_SET Whether to use default feature set ON5.6.6 
WITH_EDITLINE Which libedit/editline library to use bundled5.6.12 
WITH_EMBEDDED_SERVER Whether to build embedded server OFF  
WITH_EMBEDDED_SHARED_LIBRARY Whether to build a shared embedded server library OFF5.6.17 
WITH_xxx_STORAGE_ENGINE Compile storage engine xxx statically into server   
WITH_ERROR_INSERT Enable error injection in the NDB storage engine. Should not be used for building binaries intended for production. OFF  
WITH_EXTRA_CHARSETS Which extra character sets to include all  
WITH_INNODB_MEMCACHED Whether to generate memcached shared libraries. OFF  
WITH_LIBEDIT Use bundled libedit library ON 5.6.12
WITH_LIBEVENT Which libevent library to use bundled5.6.6 
WITH_LIBWRAP Whether to include libwrap (TCP wrappers) support OFF  
WITH_NDB_BINLOG Enable binary logging by default by mysqld. ON  
WITH_NDB_DEBUG Produce a debug build for testing or troubleshooting. OFF  
WITH_NDB_JAVA Enable building of Java and ClusterJ support. Enabled by default. Supported in MySQL Cluster only. ON  
WITH_NDB_PORT Default port used by a management server built with this option. If this option was not used to build it, the management server's default port is 1186. [none]  
WITH_NDB_TEST Include NDB API test programs. OFF  
WITH_NDBCLUSTER_STORAGE_ENGINE Build the NDB storage engine ON  
WITH_NDBMTD Build multi-threaded data node. ON  
WITH_READLINE Use bundled readline library OFF 5.6.5
WITH_SSL Type of SSL support no  
WITH_UNIXODBC Enable unixODBC support OFF  
WITH_VALGRIND Whether to compile in Valgrind header files OFF  
WITH_ZLIB Type of zlib support system  
WITHOUT_xxx_STORAGE_ENGINE Exclude storage engine xxx from build   
WITHOUT_SERVER Do not build the server OFF  

The following sections provide more information about CMake options.

For boolean options, the value may be specified as 1 or ON to enable the option, or as 0 or OFF to disable the option.

Many options configure compile-time defaults that can be overridden at server startup. For example, the CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR options that configure the default installation base directory location, TCP/IP port number, and Unix socket file can be changed at server startup with the --basedir, --port, and --socket options for mysqld. Where applicable, configuration option descriptions indicate the corresponding mysqld startup option.

General Options

Installation Layout Options

The CMAKE_INSTALL_PREFIX option indicates the base installation directory. Other options with names of the form INSTALL_xxx that indicate component locations are interpreted relative to the prefix and their values are relative pathnames. Their values should not include the prefix.

Storage Engine Options

Storage engines are built as plugins. You can build a plugin as a static module (compiled into the server) or a dynamic module (built as a dynamic library that must be installed into the server using the INSTALL PLUGIN statement or the --plugin-load option before it can be used). Some plugins might not support static or dynamic building.

The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly.

To compile a storage engine statically into the server, use -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine values are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), NDB or NDBCLUSTER (NDB), PARTITION (partitioning support), and PERFSCHEMA (Performance Schema). Examples:

-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1
Note

WITH_NDBCLUSTER_STORAGE_ENGINE is supported only when building MySQL Cluster using the MySQL Cluster sources. It cannot be used to enable clustering support in other MySQL source trees or distributions. In MySQL Cluster source distributions, it is enabled by default. See Section 18.2.2.3, “Building MySQL Cluster from Source on Linux”, and Section 18.2.3.2, “Compiling and Installing MySQL Cluster from Source on Windows”, for more information.

To exclude a storage engine from the build, use -DWITHOUT_engine_STORAGE_ENGINE=1. Examples:

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DWITHOUT_PARTITION_STORAGE_ENGINE=1

If neither -DWITH_engine_STORAGE_ENGINE nor -DWITHOUT_engine_STORAGE_ENGINE are specified for a given storage engine, the engine is built as a shared module, or excluded if it cannot be built as a shared module.

Feature Options

Compiler Flags

To specify your own C and C++ compiler flags, for flags that do not affect optimization, use the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS CMake options.

When providing your own compiler flags, you might want to specify CMAKE_BUILD_TYPE as well.

For example, to create a 32-bit release build on a 64-bit Linux machine, do this:

shell> mkdir bld
shell> cd bld
shell> cmake .. -DCMAKE_C_FLAGS=-m32 \
         -DCMAKE_CXX_FLAGS=-m32 \
         -DCMAKE_BUILD_TYPE=RelWithDebInfo

If you set flags that affect optimization (-Onumber), you must set the CMAKE_C_FLAGS_build_type and/or CMAKE_CXX_FLAGS_build_type options, where build_type corresponds to the CMAKE_BUILD_TYPE value. To specify a different optimization for the default build type (RelWithDebInfo) set the CMAKE_C_FLAGS_RELWITHDEBINFO and CMAKE_CXX_FLAGS_RELWITHDEBINFO options. For example, to compile on Linux with -O3 and with debug symbols, do this:

shell> cmake .. -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g" \
         -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g"

CMake Options for Compiling MySQL Cluster

The following options are for use when building MySQL Cluster with the MySQL Cluster sources; they are not currently supported when using sources from the MySQL 5.6 Server tree.