Connector/C++ recognizes the CMake
options described
in this section.
Table 2.1 Connector/C++ Source-Configuration Option Reference
Formats | Description | Default | Introduced |
---|---|---|---|
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 | 8.0.14 | |
CMAKE_INSTALL_INCLUDEDIR |
Header file installation directory | 8.0.14 | |
CMAKE_INSTALL_LIBDIR |
Library installation directory | 8.0.14 | |
CMAKE_INSTALL_PREFIX |
Installation base directory | /usr/local |
|
MAINTAINER_MODE |
For internal use only | OFF |
8.0.12 |
MYSQLCLIENT_STATIC_BINDING |
Whether to link to the shared MySQL client library | ON |
8.0.16 |
MYSQLCLIENT_STATIC_LINKING |
Whether to statically link to the MySQL client library | ON |
8.0.16 |
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 | ||
WITH_DOC |
Whether to generate Doxygen documentation | OFF |
|
WITH_JDBC |
Whether to build legacy JDBC library | OFF |
|
WITH_SSL |
Type of SSL support | system |
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 inCMAKE_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 isinclude
.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 islib64
orlib
.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, ifMYSQLCLIENT_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 is
ON
(use static linking to the client library). Disabling this option enables dynamic linking to the client library.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 locatemysql_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.The directory where the Boost sources are installed.
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.
-DWITH_SSL={
|ssl_type
path_name
}This option specifies which SSL library to use when compiling Connector/C++. The option value indicates the type of SSL support to include or the path name to the SSL installation to use:
ssl_type
can be one of the following values:system
: Use the system OpenSSL library.When running an application that is linked to the connector dynamic library, the OpenSSL libraries on which the connector depends should be correctly found if they are placed in the file system next to the connector library. The application should also work when the OpenSSL libraries are installed at the standard system-wide locations. This assumes that the version of OpenSSL is as expected by Connector/C++.
Compressed tar files or Zip archive distributions for for Windows, Linux, and macOS should contain the required OpenSSL libraries in the same location as the connector library.
Except for Windows, it should be possible to run an application linked to the connector dynamic library when the connector library and the OpenSSL libraries are placed in a nonstandard location, provided that these locations were stored as runtime paths when building the application (gcc
-rpath
option).For Windows, an application that is linked to the connector shared library can be run only if the connector library and the OpenSSL libraries are stored either:
In the Windows system folder
In the same folder as the application
In a folder listed in the
PATH
environment variable
If the application is linked to the connector static library, it remains true that the required OpenSSL libraries must be found in one of the preceding locations.
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 alib
subdirectory with OpenSSL libraries that are already built.Specifying a path name for the OpenSSL installation can be preferable to using the
ssl_type
value ofsystem
because it can prevent CMake from detecting and using an older or incorrect OpenSSL version installed on the system.