MySQL Connector/C++ Developer Guide  /  Installing Connector/C++ from Source  /  Connector/C++ Source-Configuration Options

4.4 Connector/C++ Source-Configuration Options

Connector/C++ recognizes the CMake options described in this section.

Table 4.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_PREFIX Installation base directory /usr/local
MAINTAINER_MODE For internal use only OFF 8.0.12
MYSQL_CONFIG_EXECUTABLE Path to the mysql_config program ${MYSQL_DIR}/bin/mysql_config
MYSQL_DIR MySQL Server or Connector/C installation directory
STATIC_MSVCRT Use the static runtime library
WITH_BOOST The Boost source directory
WITH_CONCPP The location where Connector/C++ is installed
WITH_JDBC Whether to build legacy JDBC library OFF 8.0.7
WITH_SSL Type of SSL support system 8.0.7

  • -DBUILD_STATIC=bool

    By default, dynamic (shared) libraries are built. If this option is enabled, static libraries are built instead.

  • -DBUNDLE_DEPENDENCIES=bool

    This is an internal option used for creating Connector/C++ distribution packages.

  • -DCMAKE_BUILD_TYPE=type

    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_PREFIX=dir_name

    The installation base directory (where to install Connector/C++).

  • -DMAINTAINER_MODE=bool

    This is an internal option used for creating Connector/C++ distribution packages. It was added in Connector/C++ 8.0.12.

  • -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).

  • -DMYSQL_DIR=dir_name

    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).

  • -DSTATIC_MSVCRT=bool

    (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=dir_name

    The directory where the Boost sources are installed.

  • -DWITH_CONCPP=path_name

    The location where Connector/C++ is installed. This is used when configuring the test programs so the build can find the Connector/C++ header files and libraries.

  • -DWITH_JDBC=bool

    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++. These SSL library choices are available:

    • As of Connector/C++ 8.0.12: Connector/C++ can be compiled using OpenSSL or wolfSSL. The default is OpenSSL. wolfSSL (3.14.0 or higher) can be used if the wolfSSL sources are present on your system.

    • Prior to Connector/C++ 8.0.12: Connector/C++ can be compiled using OpenSSL or yaSSL. The default is yaSSL, which is bundled with Connector/C++.

    The WITH_SSL 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. This is the default as of Connector/C++ 8.0.12.

        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.

      • bundled: Use the yaSSL library bundled with the distribution rather than OpenSSL. This option value is available only prior to Connector/C++ 8.0.12 (and is the default prior to 8.0.12). As of Connector/C++ 8.0.12, wolfSSL is the alternative to OpenSSL, so yaSSL is no longer bundled and this option value is neither valid nor the default.

    • path_name is the path name to the SSL installation to use:

      • As of Connector/C++ 8.0.12: path_name can be the path to the installed OpenSSL library or the wolfSSL sources.

      • Prior to Connector/C++ 8.0.12: path_name must be the path to the installed OpenSSL library.

      For OpenSSL, the path must point to a directory containing a lib subdirectory with OpenSSL libraries that are already built. For wolfSSL, the path must point to the source directory where the wolfSSL sources are located.

      Specifying a path name for the OpenSSL installation can be preferable to using the ssl_type value of system because it can prevent CMake from detecting and using an older or incorrect OpenSSL version installed on the system.


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.