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_nameThe documentation installation directory, relative to
CMAKE_INSTALL_PREFIX. If not specified, the default is to install inCMAKE_INSTALL_PREFIX.This option requires that
WITH_DOCbe enabled.This option was added in Connector/C++ 8.0.14.
-
-DCMAKE_INSTALL_INCLUDEDIR=dir_nameThe 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_nameThe library installation directory, relative to
CMAKE_INSTALL_PREFIX. If not specified, the default islib64orlib.This option was added in Connector/C++ 8.0.14.
-
-DCMAKE_INSTALL_PREFIX=dir_nameThe 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=boolWhether to link to the shared MySQL client library. This option is used only if
MYSQLCLIENT_STATIC_LINKINGis disabled to enable dynamic linking of the MySQL client library. In that case, ifMYSQLCLIENT_STATIC_BINDINGis 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_JDBCis enabled). It was added in Connector/C++ 8.0.16. -
-DMYSQLCLIENT_STATIC_LINKING=boolWhether 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_JDBCis enabled). It was added in Connector/C++ 8.0.16. -
-DMYSQL_CONFIG_EXECUTABLE=file_nameThe path to the mysql_config program.
On non-Windows systems, CMake checks to see whether
MYSQL_CONFIG_EXECUTABLEis set. If not, CMake tries to locatemysql_configin the default locations.This option applies only if you are building the legacy JDBC connector (that is, only if
WITH_JDBCis enabled). -
The directory where MySQL is installed.
This option applies only if you are building the legacy JDBC connector (that is, only if
WITH_JDBCis 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_nameis the path name to the file to use.
For consistency with CMake conventions,
BOOST_DIRorBOOST_ROOT_DIRcan be used instead ofWITH_BOOSTto indicate the base location of the dependency. As an alternative that implies theWITH_BOOSToption (without specifying it), useBOOST_INCLUDE_DIRto provide the header file location instead of deriving it from theBOOST_ROOT_DIRvalue.This option applies only if you are building the legacy JDBC connector (that is, only if
WITH_JDBCis 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
alltarget. -
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_nameis the path name to the installation location to use.
For consistency with CMake conventions,
LZ4_DIRorLZ4_ROOT_DIRcan be used instead ofWITH_LZ4to indicate the base location of the dependency.To imply the
WITH_LZ4option but with more fine-grained specification of installation directories, useLZ4_INCLUDE_DIRorLZ4_LIB_DIRto indicate the header file (or library) location instead of deriving it from theLZ4_ROOT_DIRvalue. To specify a list of external libraries to link to, useLZ4_LIBRARYinstead of theWITH_LZ4option.If you specify both
LZ4_LIBRARYandLZ4_LIB_DIR, thenLZ4_LIB_DIRis used as an additional prefix when finding the library file andLZ4_LIBRARYshould be relative to that prefix. On Windows,LZ4_LIBRARYshould 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_nameis 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_JDBCis enabled).For consistency with CMake conventions,
MYSQL_DIRorMYSQL_ROOT_DIRcan be used instead ofWITH_MYSQLto indicate the base location of the dependency.To imply the
WITH_MYSQLoption but with more fine-grained specification of installation directories, useMYSQL_INCLUDE_DIRorMYSQL_LIB_DIRto indicate the header file (or library) location instead of deriving it from theMYSQL_ROOT_DIRvalue. To specify a list of external libraries to link to, useMYSQL_LIBRARYinstead of theWITH_MYSQLoption.If you specify both
MYSQL_LIBRARYandMYSQL_LIB_DIR, thenMYSQL_LIB_DIRis used as an additional prefix when finding the library file andMYSQL_LIBRARYshould be relative to that prefix. On Windows,MYSQL_LIBRARYshould 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_nameis the path name to the installation location to use.
For consistency with CMake conventions,
PROTOBUF_DIRorPROTOBUF_ROOT_DIRcan be used instead ofWITH_PROTOBUFto indicate the base location of the dependency.To imply the
WITH_PROTOBUFoption but with more fine-grained specification of installation directories, usePROTOBUF_INCLUDE_DIRorPROTOBUF_LIB_DIRto indicate the header file (or library) location instead of deriving it from thePROTOBUF_ROOT_DIRvalue. To specify a list of external libraries to link to, usePROTOBUF_LIBRARYinstead of theWITH_PROTOBUFoption.If you specify both
PROTOBUF_LIBRARYandPROTOBUF_LIB_DIR, thenPROTOBUF_LIB_DIRis used as an additional prefix when finding the library file andPROTOBUF_LIBRARYshould be relative to that prefix. On Windows,PROTOBUF_LIBRARYshould point at the import library of the DLL.Similarly, specifying
PROTOBUF_BIN_DIRmakes 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_nameis 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 alibsubdirectory with OpenSSL libraries that are already built. Specifying a path name for the OpenSSL installation can be preferable to usingsystembecause it can prevent CMake from detecting and using an older or incorrect OpenSSL version installed on the system.
For consistency with CMake conventions,
SSL_DIRorSSL_ROOT_DIR(OPENSSL_ROOT_DIR) can be used instead ofWITH_SSLto indicate the base location of the dependency.To imply the
WITH_SSLoption but with more fine-grained specification of installation directories, useOPENSSL_INCLUDE_DIRorOPENSSL_LIB_DIRto indicate the header file (or library) location instead of deriving it from theSSL_ROOT_DIRvalue. To specify a list of external libraries to link to, useSSL_LIBRARYinstead of theWITH_SSLoption.If you specify both
SSL_LIBRARYandOPENSSL_LIB_DIR, thenOPENSSL_LIB_DIRis used as an additional prefix when finding the library file andSSL_LIBRARYshould be relative to that prefix. On Windows,SSL_LIBRARYshould 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_nameis the path name to the installation location to use.
For consistency with CMake conventions,
ZLIB_DIRorZLIB_ROOT_DIRcan be used instead ofWITH_ZLIBto indicate the base location of the dependency.To imply the
WITH_ZLIBoption but with more fine-grained specification of installation directories, useZLIB_INCLUDE_DIRorZLIB_LIB_DIRto indicate the header file (or library) location instead of deriving it from theZLIB_ROOT_DIRvalue. To specify a list of external libraries to link to, useZLIB_LIBRARYinstead of theWITH_ZLIBoption.If you specify both
ZLIB_LIBRARYandZLIB_LIB_DIR, thenZLIB_LIB_DIRis used as an additional prefix when finding the library file andZLIB_LIBRARYshould be relative to that prefix. On Windows,ZLIB_LIBRARYshould 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_nameis the path name to the installation location to use.
For consistency with CMake conventions,
ZSTD_DIRorZSTD_ROOT_DIRcan be used instead ofWITH_ZSTDto indicate the base location of the dependency.To imply the
WITH_ZSTDoption but with more fine-grained specification of installation directories, useZSTD_INCLUDE_DIRorZSTD_LIB_DIRto indicate the header file (or library) location instead of deriving it from theZSTD_ROOT_DIRvalue. To specify a list of external libraries to link to, useZSTD_LIBRARYinstead of theWITH_ZSTDoption.If you specify both
ZSTD_LIBRARYandZSTD_LIB_DIR, thenZSTD_LIB_DIRis used as an additional prefix when finding the library file andZSTD_LIBRARYshould be relative to that prefix. On Windows,ZSTD_LIBRARYshould point at the import library of the DLL.