MySQL Connector/C++ 9.5 Developer Guide
Connector/C++ recognizes the CMake options described
in this section.
Table 4.1 Connector/C++ Source-Configuration Option Reference
| Formats | Description | Default |
|---|---|---|
BUILD_STATIC |
Whether to build a static librarty | OFF |
BUNDLE_DEPENDENCIES |
Whether to bundle external dependency libraries with the connector | OFF |
CMAKE_BUILD_TYPE |
Type of build to produce | Debug |
CMAKE_INSTALL_DOCDIR |
Documentation installation directory | |
CMAKE_INSTALL_INCLUDEDIR |
Header file installation directory | |
CMAKE_INSTALL_LIBDIR |
Library installation directory | |
CMAKE_INSTALL_PREFIX |
Installation base directory | /usr/local |
MAINTAINER_MODE |
For internal use only | OFF |
MYSQLCLIENT_STATIC_BINDING |
Whether to link to the shared MySQL client library | ON |
MYSQLCLIENT_STATIC_LINKING |
Whether to statically link to the MySQL client library | OFF |
MYSQL_CONFIG_EXECUTABLE |
Path to the mysql_config program | ${MYSQL_DIR}/bin/mysql_config |
MYSQL_DIR |
MySQL Server installation directory | |
STATIC_MSVCRT |
Use the static runtime library | |
WITH_BOOST |
The Boost source directory | system |
WITH_DOC |
Whether to generate Doxygen documentation | OFF |
WITH_JDBC |
Whether to build legacy JDBC library | OFF |
WITH_LZ4 |
The LZ4 source directory | |
WITH_MYSQL |
The MySQL Server source directory | system |
WITH_PROTOBUF |
The Protobuf source directory | |
WITH_SSL |
The SSL source directory | system |
WITH_ZLIB |
The ZLIB source directory | |
WITH_ZSTD |
The ZSTD source directory |
By default, dynamic (shared) libraries are built. If this option is enabled, static libraries are built instead.
This is an internal option used for creating Connector/C++ distribution packages.
The type of build to produce:
Debug: Disable optimizations and
generate debugging information. This is the default.
Release: Enable optimizations.
RelWithDebInfo: Enable optimizations
and generate debugging information.
-DCMAKE_INSTALL_DOCDIR=
dir_name
The documentation installation directory, relative to
CMAKE_INSTALL_PREFIX. If not
specified, the default is to install in
CMAKE_INSTALL_PREFIX.
This option requires that
WITH_DOC be enabled.
This option was added in Connector/C++ 8.0.14.
-DCMAKE_INSTALL_INCLUDEDIR=
dir_name
The header file installation directory, relative to
CMAKE_INSTALL_PREFIX. If not
specified, the default is include.
This option was added in Connector/C++ 8.0.14.
-DCMAKE_INSTALL_LIBDIR=
dir_name
The library installation directory, relative to
CMAKE_INSTALL_PREFIX. If not
specified, the default is lib64 or
lib.
This option was added in Connector/C++ 8.0.14.
-DCMAKE_INSTALL_PREFIX=
dir_name
The installation base directory (where to install Connector/C++).
This is an internal option used for creating Connector/C++ distribution packages. It was added in Connector/C++ 8.0.12.
-DMYSQLCLIENT_STATIC_BINDING=
bool
Whether to link to the shared MySQL client library. This
option is used only if
MYSQLCLIENT_STATIC_LINKING is
disabled to enable dynamic linking of the MySQL client
library. In that case, if
MYSQLCLIENT_STATIC_BINDING is
enabled (the default), Connector/C++ is linked to the shared MySQL
client library. Otherwise, the shared MySQL client library is
loaded and mapped at runtime.
This option applies only if you are building the legacy JDBC
connector (that is, only if
WITH_JDBC is enabled). It was
added in Connector/C++ 8.0.16.
-DMYSQLCLIENT_STATIC_LINKING=
bool
Whether to link statically to the MySQL client library. The default depends on the legacy JDBC connector that you are building:
From Connector/C++ 8.0.33, the default is OFF
(use dynamic linking to the client library). Enabling this
option disables dynamic linking to the client library.
For Connector/C++ 8.0.16 to 8.0.32, the default is
ON (use static linking to the client
library). Disabling this option enables dynamic linking to
the client library. CMake verifies that
the current compiler and standard libraries can build
without errors at configuration time.
This option applies only if you are building the legacy JDBC
connector (that is, only if
WITH_JDBC is enabled). It was
added in Connector/C++ 8.0.16.
-DMYSQL_CONFIG_EXECUTABLE=
file_name
The path to the mysql_config program.
On non-Windows systems, CMake checks to see
whether MYSQL_CONFIG_EXECUTABLE
is set. If not, CMake tries to locate
mysql_config in the default locations.
This option applies only if you are building the legacy JDBC
connector (that is, only if
WITH_JDBC is enabled).
The directory where MySQL is installed.
This option applies only if you are building the legacy JDBC
connector (that is, only if
WITH_JDBC is enabled).
(Windows only) Use the static runtime library (the
/MT* compiler option). This option might be
necessary if code that uses Connector/C++ also uses the static
runtime library.
-DWITH_BOOST={system|
path_name}
This option specifies which BOOST header file to use when compiling Connector/C++ with an external dependency. The option value to use:
system: Use the system BOOST header
file.
path_name is the path name to
the file to use.
For consistency with CMake conventions,
BOOST_DIR or
BOOST_ROOT_DIR can be used instead of
WITH_BOOST to indicate the base
location of the dependency. As an alternative that implies the
WITH_BOOST option (without
specifying it), use BOOST_INCLUDE_DIR to
provide the header file location instead of deriving it from
the BOOST_ROOT_DIR value.
This option applies only if you are building the legacy JDBC
connector (that is, only if
WITH_JDBC is enabled).
Whether to enable generating the Doxygen documentation. As of
Connector/C++ 8.0.16, enabling this option also causes the Doxygen
documentation to be built by the all
target.
Whether to build the legacy JDBC connector. This option is disabled by default. If it is enabled, Connector/C++ 8.0 applications can use the legacy JDBC API, just like Connector/C++ 1.1 applications.
This option specifies which LZ4 installation to use when compiling Connector/C++ with an external dependency. The option value to use:
system: Use the system LZ4 location.
path_name is the path name to
the installation location to use.
For consistency with CMake conventions,
LZ4_DIR or LZ4_ROOT_DIR
can be used instead of WITH_LZ4
to indicate the base location of the dependency.
To imply the WITH_LZ4 option but
with more fine-grained specification of installation
directories, use LZ4_INCLUDE_DIR or
LZ4_LIB_DIR to indicate the header file (or
library) location instead of deriving it from the
LZ4_ROOT_DIR value. To specify a list of
external libraries to link to, use
LZ4_LIBRARY instead of the
WITH_LZ4 option.
If you specify both LZ4_LIBRARY and
LZ4_LIB_DIR, then
LZ4_LIB_DIR is used as an additional prefix
when finding the library file and
LZ4_LIBRARY should be relative to that
prefix. On Windows, LZ4_LIBRARY should
point at the import library of the DLL.
-DWITH_MYSQL={system|
path_name}
The location where the MySQL sources are installed. The client
library is linked statically when you specify this option
unless you also request
MYSQLCLIENT_STATIC_LINKING=OFF. The option
value to use:
system: Use the system MYSQL location.
path_name is the path name to
the installation location to use.
This option applies only if you are building the legacy JDBC
connector (that is, only if
WITH_JDBC is enabled).
For consistency with CMake conventions,
MYSQL_DIR or
MYSQL_ROOT_DIR can be used instead of
WITH_MYSQL to indicate the base
location of the dependency.
To imply the WITH_MYSQL option
but with more fine-grained specification of installation
directories, use MYSQL_INCLUDE_DIR or
MYSQL_LIB_DIR to indicate the header file
(or library) location instead of deriving it from the
MYSQL_ROOT_DIR value. To specify a list of
external libraries to link to, use
MYSQL_LIBRARY instead of the
WITH_MYSQL option.
If you specify both MYSQL_LIBRARY and
MYSQL_LIB_DIR, then
MYSQL_LIB_DIR is used as an additional
prefix when finding the library file and
MYSQL_LIBRARY should be relative to that
prefix. On Windows, MYSQL_LIBRARY should
point at the import library of the DLL.
-DWITH_PROTOBUF={system|
path_name}
This option specifies which Protobuf installation to use when compiling Connector/C++ with an external dependency. Although the library in Connector/C++ binary packages still links in Protobuf statically, using this option makes it possible to build from external sources a variant that links in Protobuf dynamically.
The option value to use:
system: Use the system Protobuf
location.
path_name is the path name to
the installation location to use.
For consistency with CMake conventions,
PROTOBUF_DIR or
PROTOBUF_ROOT_DIR can be used instead of
WITH_PROTOBUF to indicate the
base location of the dependency.
To imply the WITH_PROTOBUF
option but with more fine-grained specification of
installation directories, use
PROTOBUF_INCLUDE_DIR or
PROTOBUF_LIB_DIR to indicate the header
file (or library) location instead of deriving it from the
PROTOBUF_ROOT_DIR value. To specify a list
of external libraries to link to, use
PROTOBUF_LIBRARY instead of the
WITH_PROTOBUF option.
If you specify both PROTOBUF_LIBRARY and
PROTOBUF_LIB_DIR, then
PROTOBUF_LIB_DIR is used as an additional
prefix when finding the library file and
PROTOBUF_LIBRARY should be relative to that
prefix. On Windows, PROTOBUF_LIBRARY should
point at the import library of the DLL.
Similarly, specifying PROTOBUF_BIN_DIR
makes it possible to locate the binaries required to use the
dependency and find the compiler.
This option specifies which SSL library to use when compiling Connector/C++. The option value to use:
system: Use the system OpenSSL library.
path_name is the path name to
the SSL installation to use. It should be the path to the
installed OpenSSL library, and must point to a directory
containing a lib subdirectory with
OpenSSL libraries that are already built. Specifying a
path name for the OpenSSL installation can be preferable
to using system because it can prevent
CMake from detecting and using an older
or incorrect OpenSSL version installed on the system.
For consistency with CMake conventions,
SSL_DIR or SSL_ROOT_DIR
(OPENSSL_ROOT_DIR) can be used instead of
WITH_SSL to indicate the base
location of the dependency.
To imply the WITH_SSL option but
with more fine-grained specification of installation
directories, use OPENSSL_INCLUDE_DIR or
OPENSSL_LIB_DIR to indicate the header file
(or library) location instead of deriving it from the
SSL_ROOT_DIR value. To specify a list of
external libraries to link to, use
SSL_LIBRARY instead of the
WITH_SSL option.
If you specify both SSL_LIBRARY and
OPENSSL_LIB_DIR, then
OPENSSL_LIB_DIR is used as an additional
prefix when finding the library file and
SSL_LIBRARY should be relative to that
prefix. On Windows, SSL_LIBRARY should
point at the import library of the DLL.
-DWITH_ZLIB={system|
path_name}
This option specifies which ZLIB installation to use when compiling Connector/C++ with an external dependency. The option value to use:
system: Use the system ZLIB location.
path_name is the path name to
the installation location to use.
For consistency with CMake conventions,
ZLIB_DIR or
ZLIB_ROOT_DIR can be used instead of
WITH_ZLIB to indicate the base
location of the dependency.
To imply the WITH_ZLIB option
but with more fine-grained specification of installation
directories, use ZLIB_INCLUDE_DIR or
ZLIB_LIB_DIR to indicate the header file
(or library) location instead of deriving it from the
ZLIB_ROOT_DIR value. To specify a list of
external libraries to link to, use
ZLIB_LIBRARY instead of the
WITH_ZLIB option.
If you specify both ZLIB_LIBRARY and
ZLIB_LIB_DIR, then
ZLIB_LIB_DIR is used as an additional
prefix when finding the library file and
ZLIB_LIBRARY should be relative to that
prefix. On Windows, ZLIB_LIBRARY should
point at the import library of the DLL,
-DWITH_ZSTD={system|
path_name}
This option specifies which ZSTD installation to use when compiling Connector/C++ with an external dependency. The option value to use:
system: Use the system ZSTD location.
path_name is the path name to
the installation location to use.
For consistency with CMake conventions,
ZSTD_DIR or
ZSTD_ROOT_DIR can be used instead of
WITH_ZSTD to indicate the base
location of the dependency.
To imply the WITH_ZSTD option
but with more fine-grained specification of installation
directories, use ZSTD_INCLUDE_DIR or
ZSTD_LIB_DIR to indicate the header file
(or library) location instead of deriving it from the
ZSTD_ROOT_DIR value. To specify a list of
external libraries to link to, use
ZSTD_LIBRARY instead of the
WITH_ZSTD option.
If you specify both ZSTD_LIBRARY and
ZSTD_LIB_DIR, then
ZSTD_LIB_DIR is used as an additional
prefix when finding the library file and
ZSTD_LIBRARY should be relative to that
prefix. On Windows, ZSTD_LIBRARY should
point at the import library of the DLL.