Commit 28192e02 authored by Otto Kekäläinen's avatar Otto Kekäläinen

Imported Upstream version 10.0.8

parent aa038a23

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

Copyright (c) 2009, 2010 Sun Microsystems, Inc.
Copyright (c) 2012 Monty Program Ab
How to Build MariaDB server with CMake
CMake version 2.6 or later installed on your system.
Linux distributions:
shell> sudo apt-get install cmake
The above works on Debian/Ubuntu based distributions. On others, the command
line needs to be modified to e.g "yum install" on Fedora or "zypper install"
on OpenSUSE.
shell> pfexec pkgadd install SUNWcmake
Windows and Mac OSX:
Download and install the latest distribution from
On Windows, download installer exe file and run it. On MacOS, download
the .dmg image and open it.
Other Unixes:
Precompiled packages for other Unix flavors (HPUX, AIX) are available from
Alternatively, you can build from source, source package is also available on
CMake download page.
Compiler Tools
You will need a working compiler and make utility on your OS.
On Windows, install Visual Studio (Express editions will work too).
On Mac OSX, install Xcode tools.
Ensure that compiler and cmake are in PATH.
The following description assumes that current working directory
is the source directory.
- Generic build on Unix, using "Unix Makefiles" generator
shell>cmake .
Note: by default, cmake build is less verbose than automake build. Use
"make VERBOSE=1" if you want to see add command lines for each compiled source.
- Windows, using "Visual Studio 9 2008" generator
shell>cmake . -G "Visual Studio 9 2008"
shell>devenv MySQL.sln /build /relwithdebinfo
(alternatively, open MySQL.sln and build using the IDE)
- Windows, using "NMake Makefiles" generator
shell>cmake . -G "NMake Makefiles"
- Mac OSX build with Xcode
shell>cmake . -G Xcode
shell>xcodebuild -configuration Relwithdebinfo
(alternatively, open MySQL.xcodeproj and build using the IDE)
Command line build with CMake 2.8
After creating project with cmake -G as above, issue
cmake . --build
this works with any CMake generator.
For Visual Studio and Xcode you might want to add an extra
configuration parameter, to avoid building all configurations.
cmake . --build --config Relwithdebinfo
Building "out-of-source"
Building out-of-source provides additional benefits. For example it allows to
build both Release and Debug configurations using the single source tree.Or
build the same source with different version of the same compiler or with
different compilers. Also you will prevent polluting the source tree with the
objects and binaries produced during the make.
Here is an example on how to do it (generic Unix), assuming the source tree is
in directory named src and the current working directory is source root.
shell>mkdir ../build # build directory is called build
shell>cd ../build
shell>cmake ../src
Note: if a directory was used for in-source build, out-of-source will
not work. To reenable out-of-source build, remove <source-root>/CMakeCache.txt
The procedure above will build with default configuration.
Let's you want to change the configuration parameters and have archive
storage engine compiled into the server instead of building it as pluggable
1)You can provide parameters on the command line, like
This can be done during the initial configuration or any time later.
Note, that parameters are "sticky", that is they are remebered in the CMake
cache (CMakeCache.txt file in the build directory)
2) Configuration using cmake-gui (Windows, OSX, or Linux with cmake-gui
From the build directory, issue
shell> cmake-gui .
- Click on "Configure" button
- Click on "Generate" button
- Close cmake-gui
shell> make
3)Using ccmake (Unix)
ccmake is curses-based GUI application that provides the same functionality
as cmake-gui. It is less user-friendly compared to cmake-gui but works also
on exotic Unixes like HPUX, AIX or Solaris.
Besides storage engines, probably the most important parameter from a
developer's point of view is CMAKE_BUILD_TYPE (this allows to build server with
dbug tracing library and with debug compile flags).
After changing the configuration, recompile using
shell> make
Listing configuration parameters
shell> cmake -L
Gives a brief overview of important configuration parameters (dump to stdout)
shell> cmake -LH
Does the same but also provides a short help text for each parameter.
shell> cmake -LAH
Dumps all config parameters (including advanced) to the stdout.
-- Binary distribution --
Packaging in form of tar.gz archives (or .zip on Windows) is also supported
To create a tar.gz package,
1)If you're using "generic" Unix build with makefiles
shell> make package
this will create a tar.gz file in the top level build directory.
2)On Windows, using "NMake Makefiles" generator
shell> nmake package
3)On Windows, using "Visual Studio" generator
shell> devenv mysql.sln /build relwithdebinfo /project package
Note On Windows, 7Zip or Winzip must be installed and 7z.exe rsp winzip.exe
need to be in the PATH.
Another way to build packages is calling cpack executable directly like
shell> cpack -G TGZ --config CPackConfig.cmake
(-G TGZ is for tar.gz generator, there is also -GZIP)
-- Source distribution --
"make dist" target is provided.
ADDITIONAL MAKE TARGETS: "make install" AND "make test"
install target also provided for Makefile based generators. Installation
directory can be controlled using configure-time parameter
CMAKE_INSTALL_PREFIX (default is /usr/local. It is also possible to install to
non-configured directory, using
shell> make install DESTDIR="/some/absolute/path"
"make test" runs unit tests (uses CTest for it)
"make test-force" runs tests with --test-force parameter
If you modify MySQL source and want to add a new platform check,please read first. In MySQL, most of
the platform tests are implemented in configure.cmake and the template header
file is config.h.cmake
Bigger chunks of functionality, for example non-trivial macros are implemented
in files <src-root>/cmake subdirectory.
For people with autotools background, it is important to remember CMake does
not provide autoheader functionality. That is, when you add a check
to config.cmake, then you will also need to add
#cmakedefine HAVE_FOO 1
to config.h.cmake
Troubleshooting platform checks
If you suspect that a platform check returned wrong result, examine
<build-root>/CMakeFiles/CMakeError.log and
These files they contain compiler command line, and exact error messages.
Troubleshooting CMake code
While there are advanced flags for cmake like -debug-trycompile and --trace,
a simple and efficient way to debug to add
MESSAGE("interesting variable=${some_invariable}")
to the interesting places in CMakeLists.txt
- When using Makefile generator it is easy to examine which compiler flags are
used to build. For example, compiler flags for mysqld are in
<build-root>/sql/CMakeFiles/mysqld.dir/flags.make and the linker command line
is in <build-root>/sql/CMakeFiles/mysqld.dir/link.txt
- CMake caches results of platform checks in CMakeCache.txt. It is a nice
feature because tests do not rerun when reconfiguring (e.g when a new test was
added).The downside of caching is that when a platform test was wrong and was
later corrected, the cached result is still used. If you encounter this
situation, which should be a rare occation, you need either to remove the
offending entry from CMakeCache.txt (if test was for HAVE_FOO, remove lines
containing HAVE_FOO from CMakeCache.txt) or just remove the cache file.
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# Library General Public License for more details.
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA
cflags="$c_warnings $extra_flags $EXTRA_FLAGS $EXTRA_CFLAGS"
cxxflags="$cxx_warnings $base_cxxflags $extra_flags $EXTRA_FLAGS $EXTRA_CXXFLAGS"
extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
if test "$just_print" = "1" -a "$just_configure" = "1"
configure="$configure --print"
if test "$AM_EXTRA_MAKEFLAGS" = "VERBOSE=1" -o "$verbose_make" = "1"
configure="$configure --verbose"
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
path=`dirname $0`
. \"$path/\""
if [ -z "$just_clean" ]