Connector/C++ recognizes the CMake
options described
in this section.
Table 2.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 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 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 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.-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
orBOOST_ROOT_DIR
can be used instead ofWITH_BOOST
to indicate the base location of the dependency. As an alternative that implies theWITH_BOOST
option (without specifying it), useBOOST_INCLUDE_DIR
to provide the header file location instead of deriving it from theBOOST_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
orLZ4_ROOT_DIR
can be used instead ofWITH_LZ4
to indicate the base location of the dependency.To imply the
WITH_LZ4
option but with more fine-grained specification of installation directories, useLZ4_INCLUDE_DIR
orLZ4_LIB_DIR
to indicate the header file (or library) location instead of deriving it from theLZ4_ROOT_DIR
value. To specify a list of external libraries to link to, useLZ4_LIBRARY
instead of theWITH_LZ4
option.If you specify both
LZ4_LIBRARY
andLZ4_LIB_DIR
, thenLZ4_LIB_DIR
is used as an additional prefix when finding the library file andLZ4_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
orMYSQL_ROOT_DIR
can be used instead ofWITH_MYSQL
to indicate the base location of the dependency.To imply the
WITH_MYSQL
option but with more fine-grained specification of installation directories, useMYSQL_INCLUDE_DIR
orMYSQL_LIB_DIR
to indicate the header file (or library) location instead of deriving it from theMYSQL_ROOT_DIR
value. To specify a list of external libraries to link to, useMYSQL_LIBRARY
instead of theWITH_MYSQL
option.If you specify both
MYSQL_LIBRARY
andMYSQL_LIB_DIR
, thenMYSQL_LIB_DIR
is used as an additional prefix when finding the library file andMYSQL_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
orPROTOBUF_ROOT_DIR
can be used instead ofWITH_PROTOBUF
to indicate the base location of the dependency.To imply the
WITH_PROTOBUF
option but with more fine-grained specification of installation directories, usePROTOBUF_INCLUDE_DIR
orPROTOBUF_LIB_DIR
to indicate the header file (or library) location instead of deriving it from thePROTOBUF_ROOT_DIR
value. To specify a list of external libraries to link to, usePROTOBUF_LIBRARY
instead of theWITH_PROTOBUF
option.If you specify both
PROTOBUF_LIBRARY
andPROTOBUF_LIB_DIR
, thenPROTOBUF_LIB_DIR
is used as an additional prefix when finding the library file andPROTOBUF_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 alib
subdirectory with OpenSSL libraries that are already built. Specifying a path name for the OpenSSL installation can be preferable to usingsystem
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
orSSL_ROOT_DIR
(OPENSSL_ROOT_DIR
) can be used instead ofWITH_SSL
to indicate the base location of the dependency.To imply the
WITH_SSL
option but with more fine-grained specification of installation directories, useOPENSSL_INCLUDE_DIR
orOPENSSL_LIB_DIR
to indicate the header file (or library) location instead of deriving it from theSSL_ROOT_DIR
value. To specify a list of external libraries to link to, useSSL_LIBRARY
instead of theWITH_SSL
option.If you specify both
SSL_LIBRARY
andOPENSSL_LIB_DIR
, thenOPENSSL_LIB_DIR
is used as an additional prefix when finding the library file andSSL_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
orZLIB_ROOT_DIR
can be used instead ofWITH_ZLIB
to indicate the base location of the dependency.To imply the
WITH_ZLIB
option but with more fine-grained specification of installation directories, useZLIB_INCLUDE_DIR
orZLIB_LIB_DIR
to indicate the header file (or library) location instead of deriving it from theZLIB_ROOT_DIR
value. To specify a list of external libraries to link to, useZLIB_LIBRARY
instead of theWITH_ZLIB
option.If you specify both
ZLIB_LIBRARY
andZLIB_LIB_DIR
, thenZLIB_LIB_DIR
is used as an additional prefix when finding the library file andZLIB_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
orZSTD_ROOT_DIR
can be used instead ofWITH_ZSTD
to indicate the base location of the dependency.To imply the
WITH_ZSTD
option but with more fine-grained specification of installation directories, useZSTD_INCLUDE_DIR
orZSTD_LIB_DIR
to indicate the header file (or library) location instead of deriving it from theZSTD_ROOT_DIR
value. To specify a list of external libraries to link to, useZSTD_LIBRARY
instead of theWITH_ZSTD
option.If you specify both
ZSTD_LIBRARY
andZSTD_LIB_DIR
, thenZSTD_LIB_DIR
is used as an additional prefix when finding the library file andZSTD_LIBRARY
should be relative to that prefix. On Windows,ZSTD_LIBRARY
should point at the import library of the DLL.