To install Connector/C++ from source, verify that your system satisfies the requirements outlined in Section 4.1, “Source Installation System Prerequisites”.
On Windows, mysql_config
is not present, so
CMake attempts to retrieve the location of
MySQL from the environment variable
$ENV{MYSQL_DIR}
. If
MYSQL_DIR
is not set,
CMake checks for MySQL in the following
locations: $ENV{ProgramFiles}/MySQL/*/include
and $ENV{SystemDrive}/MySQL/*/include
.
Consult the CMake manual or check
cmake --help
to find out which build systems
are supported by your CMake version:
cmake --help
It is likely that your version of CMake supports more compilers, known by CMake as generators, than can actually be used to build Connector/C++. We have built Connector/C++ using the following generators:
Microsoft Visual Studio 2013
NMake
CMake makes it easy for you to try other compilers. However, you may experience compilation warnings or errors, or linking issues not detected by Visual Studio.
Use these steps to build Connector/C++:
-
Change location to the top-level directory of your Connector/C++ source distribution, then run CMake to generate build files for your generator.
For Visual Studio:
cmake -G "Visual Studio 12 2013"
For NMake:
cmake -G "NMake Makefiles"
To use configuration values different from the defaults, use the options described at Section 4.6, “Connector/C++ Source-Configuration Options”.
-
Use your compiler to build Connector/C++.
For Visual Studio:
Open the newly generated project files in the Visual Studio GUI or use a Visual Studio command line to build the driver. The project files contain a variety of different configurations, debug and nondebug versions among them.
For example, to use the command line, execute commands like these to build the distribution and create a Zip package:
devenv MYSQLCPPCONN.sln /build RelWithDebInfo cpack -G ZIP --config CPackConfig.cmake -C RelWithDebInfo
For NMake:
nmake