If GCC or CLang compile with link time optimization (-flto),
they throw an error during link , when lto sees a
function (e.g mysql_real_connect) is redeclared as "external void *"
in libmysql_exports.cc
The fix disables -flto for generated libmysql_exports.cc
in cmake tests let's treat clang like gcc (same options,
same builtins) in many cases.
* don't check the compiler when
* testing for -fvisibility=hidden support
* testing for HAVE_ABI_CXA_DEMANGLE
* testing for HAVE_GCC_ATOMIC_BUILTINS
* when removing options with string(replace)
* when running ${CC} --version (ignore the error instead)
* run ABI checks for clang
* use "canonical" gcc flags for clang
* fix groonga too
Also:
* add cmake detection for gcc __atomic_* builtins. they might be
supported (__ATOMIC_SEQ_CST is defined), but not for all operand
sizes. In particular, 64-bit atomic load is problematic on i386
* cache check results for Windows
* remove the test for HAVE_CXXABI_H (HAVE_ABI_CXA_DEMANGLE is
suffifient)
'mysql_config --libs' outputs -L/path/to/library
on SunOS we also want it to output '-R/path/to/library'
in order to find libraries at runtime.
cmake/libutils.cmake:
Add an informational message, to show dependencies on OS libraries.
http://lists.mysql.com/commits/102373
It is better than previous attempts to build the libmysqld,
as it also takes care of
1) -Wl,--no-undefined for shared libraries and
2) CLEAN_DIRECT_OUTPUT since there are now 2 libraries with
the same base output name
Backport version info handling (Windows-specific) from next-mr.
Instead of adding ".res" object as linker flag, add resource file (.rc) file to the source list.
This is more obvious and less error prone method.
polluting code with IF(CMAKE_SYSTEM_NAME MATCHES...), first on Windows.
cmake/libutils.cmake:
Fix the case in MERGE_LIBRARIES, where there is no dependency on OS libraries.
cmake/os/Windows.cmake:
Move windows specific code to cmake/os/Windows.cmake
configure.cmake:
Move some Windows code to cmake/os/Windows.cmake
using cmake option INSTALL_LAYOUT=STANDALONE would produce the layout as in
tar.gz or zip packages.
INSTALL_LAYOUT=UNIX will produce unixish install layout (with mysqld being in sbin subdirectory , libs in lib/mysql etc). This layout is used for RPM packages.
Subtle differences in both packages unfortunately lead to the need to recompile MySQL to use with other package type - as otherwise for example default plugins or data directories would be wrong set.
There are numerous other variables that allow fine-tuning packaging layout. (INSTALL_BINDIR, INSTALL_LIBDIR , INSTALL_PLUGINDIR etc).
This options are different from autotools as they do not expect full paths to directories, but only subdirectory of CMAKE_INSTALL_PREFIX.
There are 2 special options that expect full directory paths
- MYSQL_DATADIR that defines default MYSQL data directory (autotools equivalent
is --localstatedir)
- SYSCONFDIR can be added to search my.cnf search path (autotools equivalent is --sysconfdir)
MYSQL_ADD_EXECUTABLE will instructs CPack where to install the exe. On Windows, it also
adds version resource and if -DSIGNCODE was given, will sign the exe in packaging step.