summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2011-01-29 18:51:12 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2011-01-29 18:51:12 +0100
commitb19e99865ccf3e946ebe59bf09add8e0452904ac (patch)
tree23cb9e8176ef9d0e276b47d197e11d195b2ecafb
parent3edf4dcd5a36be8d5acc94e0c5e29e77e47cd15b (diff)
downloadmariadb-git-b19e99865ccf3e946ebe59bf09add8e0452904ac.tar.gz
MWL#55 : cherrypick MySQL 5.5 CMake/build improvements in order
to be able to build MSI based installer
-rwxr-xr-xCMakeLists.txt209
-rwxr-xr-xclient/CMakeLists.txt45
-rwxr-xr-xextra/CMakeLists.txt18
-rw-r--r--extra/libevent/CMakeLists.txt12
-rw-r--r--include/CMakeLists.txt66
-rw-r--r--include/Makefile.am2
-rwxr-xr-xlibmysql/CMakeLists.txt14
-rw-r--r--libmysqld/CMakeLists.txt18
-rw-r--r--libmysqld/examples/CMakeLists.txt15
-rw-r--r--mysql-test/CMakeLists.txt137
-rw-r--r--mysql-test/Makefile.am6
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm13
-rw-r--r--mysql-test/lib/My/SafeProcess.pm17
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt19
-rw-r--r--mysql-test/mtr.out-of-source5
-rwxr-xr-xmysql-test/mysql-test-run.pl110
-rw-r--r--mysql-test/r/mysqlcheck.result1
-rw-r--r--mysql-test/t/mysqlcheck.test1
-rw-r--r--mysys/CMakeLists.txt2
-rwxr-xr-xregex/CMakeLists.txt2
-rwxr-xr-xscripts/CMakeLists.txt39
-rw-r--r--scripts/comp_sql.c111
-rw-r--r--scripts/mysql_install_db.pl.in6
-rwxr-xr-xserver-tools/instance-manager/CMakeLists.txt2
-rwxr-xr-xsql/CMakeLists.txt153
-rw-r--r--sql/Makefile.am2
-rw-r--r--sql/share/CMakeLists.txt54
-rw-r--r--sql/share/Makefile.am2
-rw-r--r--storage/maria/CMakeLists.txt23
-rw-r--r--storage/myisam/CMakeLists.txt17
-rw-r--r--storage/mysql_storage_engine.cmake11
-rwxr-xr-xstrings/CMakeLists.txt2
-rwxr-xr-xtests/CMakeLists.txt2
-rw-r--r--win/Makefile.am38
-rw-r--r--win/build_maria_release.bat47
-rw-r--r--win/cmake/cmake_parse_arguments.cmake47
-rw-r--r--win/cmake/cpack_source_ignore_files.cmake40
-rw-r--r--win/cmake/create_initial_db.cmake.in84
-rw-r--r--win/cmake/install_layout.cmake223
-rw-r--r--win/cmake/install_macros.cmake338
-rw-r--r--win/cmake/mysql_add_executable.cmake56
-rw-r--r--win/cmake/mysql_version.cmake140
-rw-r--r--win/cmake/package_name.cmake134
-rw-r--r--win/cmake/versioninfo.rc.in23
-rw-r--r--win/make_mariadb_win_dist7
-rwxr-xr-xzlib/CMakeLists.txt2
46 files changed, 1908 insertions, 407 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d918a4a71e..f00b53b9abb 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,25 +17,55 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0005 NEW)
ENDIF(COMMAND cmake_policy)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/win/cmake)
PROJECT(MySql)
+include(package_name)
+include(mysql_version)
+include(mysql_add_executable)
+include(install_macros)
+include(install_layout)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
+
+# Hardcode WITH_XXX_STORAGE_ENGINE to ON for storage engines that go into the
+# distributable package, this is temporary solution to get rid of configure.js stuff,
+# 5.5 will handle it more nicely.
+
+SET(WITH_ARCHIVE_STORAGE_ENGINE 1 CACHE BOOL "Include archive storage engine")
+SET(WITH_BLACKHOLE_STORAGE_ENGINE 1 CACHE BOOL "Include blockhole storage engine")
+SET(WITH_FEDERATEDX_STORAGE_ENGINE 1 CACHE BOOL "Include federatedx storage engine")
+SET(WITH_PARTITION_STORAGE_ENGINE 1 CACHE BOOL "Include partition storage engine")
+SET(WITH_ARIA_STORAGE_ENGINE 1 CACHE BOOL "Include aria storage engine")
+SET(WITH_PBXT_STORAGE_ENGINE 1 CACHE BOOL "Include pbxt storage engine")
+SET(WITH_XTRADB_STORAGE_ENGINE 1 CACHE BOOL "Include xtradb storage engine")
+IF(WIN32)
+ LINK_LIBRARIES(ws2_32)
+ # This reads user configuration, generated by configure.js.
+ INCLUDE(win/configure.data OPTIONAL)
+ENDIF()
-# This reads user configuration, generated by configure.js.
-INCLUDE(win/configure.data)
-# Hardcode support for CSV storage engine
-SET(WITH_CSV_STORAGE_ENGINE TRUE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
- ${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
+ ${CMAKE_BINARY_DIR}/include/mysql_version.h @ONLY)
+
+# Speed up multiprocessor build
+IF (MSVC_VERSION GREATER 1400)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+ENDIF()
+
+SET(CMAKE_INSTALL_PREFIX "C:/MariaDB${MYSQL_BASE_VERSION}")
+SET(INSTALL_ROOT "${CMAKE_INSTALL_PREFIX}")
# Set standard options
ADD_DEFINITIONS(-DHAVE_YASSL)
ADD_DEFINITIONS(-DCMAKE_CONFIGD)
-ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
-ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
-ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
-ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
+ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="${INSTALL_ROOT}")
+ADD_DEFINITIONS(-DDEFAULT_BASEDIR="${INSTALL_ROOT}")
+ADD_DEFINITIONS(-DMYSQL_DATADIR="data")
+ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="${INSTALL_ROOT}")
ADD_DEFINITIONS(-DPACKAGE=mysql)
ADD_DEFINITIONS(-DSHAREDIR="share")
ADD_DEFINITIONS(-DPLUGINDIR="lib/plugin")
@@ -46,15 +76,15 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
SET(localstatedir "C:\\mysql\\data")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
- ${CMAKE_SOURCE_DIR}/support-files/my-huge.ini @ONLY)
+ ${CMAKE_BINARY_DIR}/support-files/my-huge.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.cnf.sh
- ${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.ini @ONLY)
+ ${CMAKE_BINARY_DIR}/support-files/my-innodb-heavy-4G.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-large.cnf.sh
- ${CMAKE_SOURCE_DIR}/support-files/my-large.ini @ONLY)
+ ${CMAKE_BINARY_DIR}/support-files/my-large.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
- ${CMAKE_SOURCE_DIR}/support-files/my-medium.ini @ONLY)
+ ${CMAKE_BINARY_DIR}/support-files/my-medium.ini @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
- ${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
+ ${CMAKE_BINARY_DIR}/support-files/my-small.ini @ONLY)
ADD_DEFINITIONS(-D__NT__)
@@ -303,7 +333,7 @@ ADD_DEFINITIONS(${STORAGE_ENGINE_DEFS})
# Now write out our mysql_plugin_defs struct
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
- ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)
+ ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc @ONLY)
# Add subdirectories for storage engines
SET (ENGINE_BUILD_TYPE "STATIC")
@@ -330,12 +360,14 @@ ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
ADD_SUBDIRECTORY(extra/libevent)
ADD_SUBDIRECTORY(extra)
-ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(sql)
+ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(server-tools/instance-manager)
ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(libservices)
ADD_SUBDIRECTORY(tests)
+ADD_SUBDIRECTORY(mysql-test)
+ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(unittest/mytap)
ADD_SUBDIRECTORY(unittest/mysys)
IF(WITH_EMBEDDED_SERVER)
@@ -343,126 +375,31 @@ IF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(libmysqld/examples)
ENDIF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
+IF(WIN32)
+ ADD_SUBDIRECTORY(win/upgrade_wizard)
+ ADD_SUBDIRECTORY(win/packaging)
+ENDIF()
-# Set up the installer
-SET(CPACK_PACKAGE_NAME "MariaDB")
-STRING(REPLACE "-MariaDB" "" CPACK_PACKAGE_VERSION ${VERSION})
-SET(CPACK_PACKAGE_VENDOR "Monty Program AB http://www.montyprogram.com")
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB")
-SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
-SET(CPACK_GENERATOR NSIS)
-
-# Use our own NSIS template
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/win/cmake" ${CMAKE_MODULE_PATH})
-
-# Installer components and grouping
-SET(CPACK_COMPONENT_GROUP_SERVER_DESCRIPTION "The files necessary for running the MariaDB server.")
-SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files used in development on the MariaDB server.")
-SET(CPACK_ALL_INSTALL_TYPES Normal Development)
-SET(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "MariaDB server")
-SET(CPACK_COMPONENT_RUNTIME_DESCRIPTION "The server itself. You want to install this one.")
-SET(CPACK_COMPONENT_RUNTIME_GROUP "Server")
-SET(CPACK_COMPONENT_RUNTIME_INSTALL_TYPES Normal Development)
-SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Development headers")
-SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Header files for development on MariaDB.")
-SET(CPACK_COMPONENT_HEADERS_DEPENDS runtime)
-SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
-SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Development)
-SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded")
-SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Files for embedding MariaDB in other projects.")
-SET(CPACK_COMPONENT_EMBEDDED_DEPENDS headers)
-SET(CPACK_COMPONENT_EMBEDDED_GROUP "Development")
-SET(CPACK_COMPONENT_EMBEDDED_INSTALL_TYPES Development)
-SET(CPACK_COMPONENT_SCRIPTS_DISPLAY_NAME "Server scripts")
-SET(CPACK_COMPONENT_SCRIPTS_DESCRIPTION "SQL and Perl scripts to control and modify the server. You need a perl installation for some of these to work.")
-SET(CPACK_COMPONENT_SCRIPTS_DEPENDS runtime)
-SET(CPACK_COMPONENT_SCRIPTS_GROUP "Server")
-SET(CPACK_COMPONENT_SCRIPTS_INSTALL_TYPES Normal Development)
-SET(CPACK_COMPONENT_MYSQLTEST_DISPLAY_NAME "MariaDB test suite")
-SET(CPACK_COMPONENT_MYSQLTEST_DESCRIPTION "The MariaDB regression test suite.")
-SET(CPACK_COMPONENT_MYSQLTEST_DEPENDS runtime)
-SET(CPACK_COMPONENT_MYSQLTEST_GROUP "Testing")
-SET(CPACK_COMPONENT_MYSQLTEST_INSTALL_TYPES Normal Development)
-SET(CPACK_COMPONENT_SQLBENCH_DISPLAY_NAME "SQL Bench")
-SET(CPACK_COMPONENT_SQLBENCH_DESCRIPTION "The MariaDB benchmark suite.")
-SET(CPACK_COMPONENT_SQLBENCH_DEPENDS runtime)
-SET(CPACK_COMPONENT_SQLBENCH_GROUP "Testing")
-SET(CPACK_COMPONENT_SQLBENCH_INSTALL_TYPES Normal Development)
-
-# Add files to the installer
-INSTALL(FILES COPYING EXCEPTIONS-CLIENT DESTINATION .)
-INSTALL(FILES support-files/my-huge.ini support-files/my-innodb-heavy-4G.ini DESTINATION .)
-INSTALL(FILES support-files/my-large.ini support-files/my-medium.ini DESTINATION .)
-INSTALL(FILES support-files/my-small.ini DESTINATION .)
-INSTALL(FILES Docs/INSTALL-BINARY DESTINATION Docs)
-INSTALL(FILES COPYING DESTINATION Docs)
-FILE(GLOB headerfiles "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
-INSTALL(FILES ${headerfiles} DESTINATION include COMPONENT headers)
-INSTALL(FILES include/mysql/plugin.h DESTINATION include/mysql COMPONENT headers)
-INSTALL(FILES libmysql/libmysql.def DESTINATION include COMPONENT headers)
-
-# Handle the database files
-FILE(GLOB datafiles "${CMAKE_CURRENT_SOURCE_DIR}/win/data/mysql/*")
-INSTALL(FILES ${datafiles} DESTINATION data/clean/mysql)
-INSTALL(FILES win/data/aria_log.00000001 win/data/aria_log_control DESTINATION data/clean)
-INSTALL(DIRECTORY win/data/test DESTINATION data/clean)
-SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
- IfFileExists '$INSTDIR\\\\data\\\\mysql\\\\db.frm' 0 CopyDatabaseFiles
- MessageBox MB_OK 'There are already database files present in the data directory. Clean database files are not written to the directory'
- GoTo EndCopyDatabaseFiles
- CopyDatabaseFiles:
- CopyFiles '$INSTDIR\\\\data\\\\clean\\\\*' '$INSTDIR\\\\data'
- EndCopyDatabaseFiles:")
-SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
- MessageBox MB_OK 'This will not delete the database files in $INSTDIR\\\\data'")
-
-# Files in the share dir
-INSTALL(FILES sql/share/errmsg.txt DESTINATION share COMPONENT runtime)
-FILE(GLOB charsets sql/share/charsets/*)
-INSTALL(FILES ${charsets} DESTINATION share/charsets COMPONENT runtime)
-FILE(GLOB share_dirs sql/share/*/errmsg.sys)
-FOREACH(ERRMSGFILE ${share_dirs})
- STRING(REPLACE "//" "/" ERRMSGFILE ${ERRMSGFILE}) # Work around a cmake bug
- FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${ERRMSGFILE})
- STRING(REPLACE "/errmsg.sys" "" DIRNAME ${DIRNAME})
- INSTALL(FILES ${ERRMSGFILE} DESTINATION share/${DIRNAME} COMPONENT runtime)
-ENDFOREACH(ERRMSGFILE ${share_dirs})
-
-# MTR files
-FILE(GLOB_RECURSE testfiles mysql-test/*)
-FOREACH(testfile ${testfiles})
- FILE(RELATIVE_PATH dirname ${PROJECT_SOURCE_DIR} ${testfile})
- GET_FILENAME_COMPONENT(dirname ${dirname} PATH)
- GET_FILENAME_COMPONENT(filename ${testfile} NAME)
- GET_FILENAME_COMPONENT(ext ${testfile} EXT)
- SET(ok "yes")
- IF (NOT "x_${ext}" STREQUAL "x_")
- # Test if this is one of the extensions we don't want to install
- STRING(TOLOWER ${ext} ext)
- IF(${ext} STREQUAL ".dir" OR ${ext} STREQUAL ".vcproj" OR ${ext} STREQUAL ".user" OR ${ext} STREQUAL ".ilk"
- OR ${ext} STREQUAL ".idb" OR ${ext} STREQUAL ".map" OR ${ext} STREQUAL ".gcov"
- OR ${ext} STREQUAL ".supp" OR ${ext} STREQUAL ".am" OR ${ext} STREQUAL ".stress")
- SET(ok "no")
- ENDIF()
- ENDIF(NOT "x_${ext}" STREQUAL "x_")
- IF (${ok} STREQUAL "yes")
- # Message("Dir: ${dirname}. File: ${filename}. Ext: ${ext}")
- INSTALL(FILES ${testfile} DESTINATION ${dirname} COMPONENT mysqltest)
- ENDIF(${ok} STREQUAL "yes")
-ENDFOREACH(testfile ${testfiles})
-
-# SQL Bench
-FILE(GLOB_RECURSE benchfiles sql-bench/*)
-FOREACH(testfile ${testfiles})
- FILE(RELATIVE_PATH dirname ${PROJECT_SOURCE_DIR} ${testfile})
- GET_FILENAME_COMPONENT(dirname ${dirname} PATH)
- GET_FILENAME_COMPONENT(filename ${testfile} NAME)
- IF(NOT ${dirname} STREQUAL "sql-bench" OR ${filename} STREQUAL "README")
- INSTALL(FILES ${testfile} DESTINATION ${dirname} COMPONENT sqlbench)
- ENDIF()
-ENDFOREACH(testfile ${testfiles})
-
-INCLUDE(InstallRequiredSystemLibraries)
-
+IF(WIN32)
+ SET(CPACK_GENERATOR "ZIP")
+ENDIF()
+INSTALL(FILES
+ ${CMAKE_BINARY_DIR}/support-files/my-huge.ini
+ ${CMAKE_BINARY_DIR}/support-files/my-large.ini
+ ${CMAKE_BINARY_DIR}/support-files/my-medium.ini
+ ${CMAKE_BINARY_DIR}/support-files/my-small.ini
+ DESTINATION .
+ COMPONENT IniFiles
+)
+INSTALL(FILES
+ COPYING
+ EXCEPTIONS-CLIENT
+ DESTINATION .
+ COMPONENT Readme
+)
+IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" STREQUAL "2.8.3")
+ # CMake bug#11452, only in 2.8.3
+ SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "")
+ENDIF()
# This must always be the last line
INCLUDE(CPack)
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 8febb62481e..4105922fa90 100755
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -25,63 +25,48 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
- ${CMAKE_SOURCE_DIR}/strings)
+ ${CMAKE_SOURCE_DIR}/strings
+ ${CMAKE_CURRENT_BINARY_DIR})
-ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
+MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqltest mysqltest.cc)
+MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc DESTINATION bin)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug)
-ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
+MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c)
+MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqlimport mysqlimport.c)
+MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
+MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient_notls wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
-ADD_EXECUTABLE(mysqlshow mysqlshow.c)
+MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
+MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
../mysys/mf_tempdir.c
../mysys/my_new.cc
../mysys/my_bit.c
../mysys/my_bitmap.c
../mysys/my_vle.c
- ../mysys/base64.c)
+ ../mysys/base64.c
+ DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
+MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqlslap mysqlslap.c)
+MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c DESTINATION bin)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib wsock32 dbug)
-ADD_EXECUTABLE(echo echo.c)
-IF(EMBED_MANIFESTS)
- MYSQL_EMBED_MANIFEST("mysql" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqltest" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqlcheck" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqldump" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqlimport" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysql_upgrade" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqlshow" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqlbinlog" "asInvoker")
- MYSQL_EMBED_MANIFEST("mysqladmin" "asInvoker")
- MYSQL_EMBED_MANIFEST("echo" "asInvoker")
-ENDIF(EMBED_MANIFESTS)
-
-ADD_DEFINITIONS(-DHAVE_DLOPEN)
-
-INSTALL(TARGETS mysql mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow
- mysqlbinlog mysqladmin mysqlslap echo DESTINATION bin COMPONENT runtime)
+MYSQL_ADD_EXECUTABLE(echo echo.c COMPONENT Test)
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index 6cc69d3251e..f87dc1d0831 100755
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -22,19 +22,19 @@ TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h
COMMAND ${COMP_ERR_EXE}
--charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
- --out-dir=${PROJECT_SOURCE_DIR}/sql/share/
- --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
- --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
- --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
+ --out-dir=${CMAKE_BINARY_DIR}/sql/share/
+ --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h
+ --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h
+ --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt)
ADD_CUSTOM_TARGET(GenError
ALL
- DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
+ DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h)
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32)
@@ -48,8 +48,4 @@ TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32)
ADD_EXECUTABLE(replace replace.c)
TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32)
-IF(EMBED_MANIFESTS)
- MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
-ENDIF(EMBED_MANIFESTS)
-
-INSTALL(TARGETS comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT runtime)
+MYSQL_INSTALL_TARGETS(comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT Server)
diff --git a/extra/libevent/CMakeLists.txt b/extra/libevent/CMakeLists.txt
index 83a6cf0f220..6be15641d3e 100644
--- a/extra/libevent/CMakeLists.txt
+++ b/extra/libevent/CMakeLists.txt
@@ -2,7 +2,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/extra/libevent
${CMAKE_SOURCE_DIR}/extra/libevent/compat
${CMAKE_SOURCE_DIR}/extra/libevent/WIN32-Code
- ${CMAKE_SOURCE_DIR}/include)
+ ${CMAKE_BINARY_DIR}/extra/libevent
+ ${CMAKE_SOURCE_DIR}/include
+)
IF(MSVC)
ADD_DEFINITIONS("-DWIN32 -DHAVE_CONFIG_H")
@@ -28,8 +30,14 @@ SET(LIBEVENT_SOURCES
min_heap.h
strlcpy-internal.h
)
+IF(WIN32)
+ # Workaround source distribution bug, remove preconfigured event-config
+ IF(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+ FILE(REMOVE ${CMAKE_SOURCE_DIR}/extra/libevent/event-config.h)
+ ENDIF()
+ CONFIGURE_FILE(WIN32-Code/config.h ${CMAKE_BINARY_DIR}/extra/libevent/event-config.h COPYONLY)
+ENDIF()
-CONFIGURE_FILE(WIN32-Code/config.h ${CMAKE_SOURCE_DIR}/extra/libevent/event-config.h COPYONLY)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(libevent ${LIBEVENT_SOURCES})
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
index 00000000000..9bafbd43793
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1,66 @@
+# Copyright (c) 2006, 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 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+SET(HEADERS_GEN_CONFIGURE
+${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h
+#${CMAKE_CURRENT_BINARY_DIR}/my_config.h
+${CMAKE_CURRENT_BINARY_DIR}/mysqld_ername.h
+${CMAKE_CURRENT_BINARY_DIR}/mysqld_error.h
+${CMAKE_CURRENT_BINARY_DIR}/sql_state.h
+)
+SET(HEADERS_ABI
+ mysql.h
+ mysql_com.h
+ mysql_time.h
+ my_list.h
+ my_alloc.h
+ typelib.h
+ mysql/plugin.h
+ mysql/plugin_auth.h
+ mysql/client_plugin.h
+)
+
+SET(HEADERS
+ ${HEADERS_ABI}
+ config-win.h
+ my_dbug.h
+ m_string.h
+ my_sys.h
+ my_xml.h
+ mysql_embed.h
+ my_pthread.h
+ my_no_pthread.h
+ decimal.h
+ errmsg.h
+ my_global.h
+ my_net.h
+ my_getopt.h
+ sslopt-longopts.h
+ my_dir.h
+ sslopt-vars.h
+ sslopt-case.h
+ sql_common.h
+ keycache.h
+ m_ctype.h
+ my_attribute.h
+ my_compiler.h
+ ${HEADERS_GEN_CONFIGURE}
+)
+
+INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
+INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR}/mysql COMPONENT Development FILES_MATCHING PATTERN "*.h" )
+
+
+
diff --git a/include/Makefile.am b/include/Makefile.am
index d423e500aae..d81eb5f505c 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -46,7 +46,7 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
wqueue.h waiting_threads.h
-EXTRA_DIST = mysql.h.pp mysql/plugin_auth.h.pp mysql/client_plugin.h.pp
+EXTRA_DIST = mysql.h.pp mysql/plugin_auth.h.pp mysql/client_plugin.h.pp CMakeLists.txt
# Remove built files and the symlinked directories
CLEANFILES = $(BUILT_SOURCES) readline openssl
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index fad34ac89a3..2c9434b3a15 100755
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -124,14 +124,8 @@ ADD_DEPENDENCIES(libmysql GenError)
TARGET_LINK_LIBRARIES(libmysql wsock32)
ADD_DEFINITIONS(-DHAVE_DLOPEN)
-IF(EMBED_MANIFESTS)
- MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
-ENDIF(EMBED_MANIFESTS)
-# TODO: Install mysqlclient_notls?
-# TODO: Which component should these be part of, development?
-INSTALL(TARGETS mysqlclient DESTINATION lib/opt COMPONENT runtime)
-INSTALL(TARGETS libmysql DESTINATION lib/opt COMPONENT runtime)
-
-# Also install libmysql.dll to the bin dir
-INSTALL(TARGETS libmysql DESTINATION bin COMPONENT runtime)
+INSTALL(TARGETS mysqlclient DESTINATION lib COMPONENT Development)
+INSTALL_DEBUG_SYMBOLS(mysqlclient DESTINATION lib)
+INSTALL(TARGETS libmysql DESTINATION lib COMPONENT SharedLibraries)
+INSTALL_DEBUG_SYMBOLS(libmysql DESTINATION lib)
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 27850357127..18ac1af9516 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -28,14 +28,15 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include
- ${CMAKE_SOURCE_DIR}/zlib)
+ ${CMAKE_SOURCE_DIR}/zlib
+ ${CMAKE_BINARY_DIR}/sql)
-SET(GEN_SOURCES ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
- ${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
+SET(GEN_SOURCES ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
${CMAKE_SOURCE_DIR}/sql/message.h
${CMAKE_SOURCE_DIR}/sql/message.rc
- ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
- ${CMAKE_SOURCE_DIR}/sql/lex_hash.h)
+ ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
+ ${CMAKE_BINARY_DIR}/sql/lex_hash.h)
SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1)
@@ -166,6 +167,9 @@ ADD_LIBRARY(libmysqld SHARED cmake_dummy.c libmysqld.def)
ADD_DEPENDENCIES(libmysqld mysqlserver)
TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32)
-INSTALL(TARGETS mysqlserver DESTINATION Embedded/static COMPONENT embedded)
+INSTALL(TARGETS mysqlserver DESTINATION lib COMPONENT Embedded)
+INSTALL_DEBUG_SYMBOLS(mysqlserver)
+INSTALL_DEBUG_TARGET(mysqlserver DESTINATION lib/debug COMPONENT Embedded)
-INSTALL(TARGETS libmysqld DESTINATION Embedded/DLL COMPONENT embedded)
+INSTALL(TARGETS libmysqld DESTINATION lib COMPONENT Embedded)
+INSTALL_DEBUG_SYMBOLS(libmysqld)
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index 5194836a728..1f41d608099 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -26,16 +26,17 @@ ENDIF(WIN32)
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
-ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
+
+MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
- ../../client/sql_string.cc)
+ COMPONENT Test)
TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
-TARGET_LINK_LIBRARIES(mysql_embedded libmysqld)
+TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
-ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
+MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc COMPONENT Test)
TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
-TARGET_LINK_LIBRARIES(mysqltest_embedded libmysqld)
+TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver)
-ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
+MYSQL_ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c COMPONENT Test)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
-TARGET_LINK_LIBRARIES(mysql_client_test_embedded libmysqld)
+TARGET_LINK_LIBRARIES(mysql_client_test_embedded mysqlserver)
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
new file mode 100644
index 00000000000..38b934c476c
--- /dev/null
+++ b/mysql-test/CMakeLists.txt
@@ -0,0 +1,137 @@
+# Copyright (c) 2006, 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 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+IF(INSTALL_MYSQLTESTDIR)
+INSTALL(
+ DIRECTORY .
+ DESTINATION ${INSTALL_MYSQLTESTDIR}
+ USE_SOURCE_PERMISSIONS
+ COMPONENT Test
+ PATTERN "var/" EXCLUDE
+ PATTERN "lib/My/SafeProcess" EXCLUDE
+ PATTERN "lib/t*" EXCLUDE
+ PATTERN "CPack" EXCLUDE
+ PATTERN "CMake*" EXCLUDE
+ PATTERN "mtr.out*" EXCLUDE
+ PATTERN ".cvsignore" EXCLUDE
+ PATTERN "*.am" EXCLUDE
+ PATTERN "*.in" EXCLUDE
+ PATTERN "*.vcproj" EXCLUDE
+ PATTERN "*.vcxproj" EXCLUDE
+ PATTERN "*.vcxproj.*" EXCLUDE
+)
+ENDIF()
+
+
+
+IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+ # Enable running mtr from build directory
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/mtr.out-of-source
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run.pl
+ @ONLY
+ )
+ENDIF()
+IF(UNIX)
+ EXECUTE_PROCESS(
+ COMMAND chmod +x mysql-test-run.pl
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ ./mysql-test-run.pl mtr
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ ./mysql-test-run.pl mysql-test-run
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ IF(INSTALL_MYSQLTESTDIR)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
+ DESTINATION ${INSTALL_MYSQLTESTDIR}
+ COMPONENT Test)
+ ENDIF()
+ENDIF()
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ SET(SETCONFIG_COMMAND set MTR_VS_CONFIG=${CMAKE_CFG_INTDIR})
+ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
+ SET(SETCONFIG_COMMAND export MTR_VS_CONFIG=${CMAKE_CFG_INTDIR})
+ELSE()
+ SET(SETCONFIG_COMMAND echo Running tests)
+ENDIF()
+IF(CYGWIN)
+ # On cygwin, pretend to be "Unix" system
+ SET(SETOS_COMMAND export MTR_CYGWIN_IS_UNIX=1)
+ELSE()
+ SET(SETOS_COMMAND echo OS=${CMAKE_SYSTEM_NAME})
+ENDIF()
+
+
+
+SET(EXP --experimental=collections/default.experimental)
+IF(WIN32)
+ SET(SET_ENV set)
+ELSE()
+ SET(SET_ENV export)
+ENDIF()
+
+
+SET(MTR_FORCE perl ./mysql-test-run.pl --force)
+IF(EXISTS ${CMAKE_SOURCE_DIR}/mysql-test/suite/nist)
+ SET(TEST_NIST ${MTR_FORCE} --comment=nist suite=nist ${EXP} &&
+ ${MTR_FORCE} --comment=nist --force --suite=nist+ps ${EXP})
+ELSE()
+ SET(TEST_NIST echo "NIST tests not found")
+ENDIF()
+
+IF(WITH_EMBEDDED_SERVER)
+ SET(TEST_EMBEDDED ${MTR_FORCE} --comment=embedded --timer --embedded-server
+ --skip-rpl --skip-ndbcluster $(EXP))
+ELSE()
+ SET(TEST_EMBEDDED echo "Can not test embedded, not compiled in")
+ENDIF()
+
+SET(TEST_BT_START
+ COMMAND ${SETCONFIG_COMMAND}
+ COMMAND ${SETOS_COMMAND}
+ COMMAND ${SET_ENV} MTR_BUILD_THREAD=auto
+)
+
+ADD_CUSTOM_TARGET(test-force
+ ${TEST_BT_START}
+ COMMAND ${MTR_FORCE}
+)
+
+ADD_CUSTOM_TARGET(test-bt
+ ${TEST_BT_START}
+ COMMAND ${MTR_FORCE} --comment=normal --timer --skip-ndbcluster --report-features ${EXP}
+ COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol ${EXP}
+ COMMAND ${MTR_FORCE} --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 ${EXP}
+ COMMAND ${MTR_FORCE} --comment=funcs2 --suite=funcs_2 ${EXP}
+ COMMAND ${MTR_FORCE} --comment=partitions --suite=parts ${EXP}
+ COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP}
+ COMMAND ${MTR_FORCE} --force --comment=jp --suite=jp ${EXP}
+ COMMAND ${TEST_NIST}
+ COMMAND ${TEST_EMBEDDED}
+)
+
+ADD_CUSTOM_TARGET(test-bt-fast
+ ${TEST_BT_START}
+ COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol --report-features ${EXP}
+ COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP}
+)
+
+ADD_CUSTOM_TARGET(test-bt-debug
+ ${TEST_BT_START}
+ COMMAND ${MTR_FORCE} --comment=debug --timer --skip-ndbcluster --skip-rpl --report-features ${EXP}
+)
+
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 07cf5fc8e7b..b55e3449be0 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -72,7 +72,9 @@ SUBDIRS = lib/My/SafeProcess
EXTRA_DIST = README README.suites \
$(test_SCRIPTS) \
- $(nobase_test_DATA)
+ $(nobase_test_DATA) \
+ CMakeLists.txt \
+ mtr.out-of-source
# List of directories containing test + result files and the
# related test data files that should be copied
@@ -109,7 +111,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r \
suite/innodb_plugin/include \
- suite/handler \
+ suite/percona suite/handler \
suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index 9f8de3e5830..626d14fd0e1 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -37,6 +37,15 @@ sub get_testdir {
return $testdir;
}
+# Retrive build directory (which is different from basedir in out-of-source build)
+sub get_bindir {
+ if (defined $ENV{MTR_BINDIR})
+ {
+ return $ENV{MTR_BINDIR};
+ }
+ my ($self, $group)= @_;
+ return $self->get_basedir($group);
+}
sub fix_charset_dir {
my ($self, $config, $group_name, $group)= @_;
@@ -46,7 +55,7 @@ sub fix_charset_dir {
sub fix_language {
my ($self, $config, $group_name, $group)= @_;
- return my_find_dir($self->get_basedir($group),
+ return my_find_dir($self->get_bindir($group),
\@share_locations, "english");
}
@@ -339,6 +348,7 @@ my @mysql_upgrade_rules=
sub post_check_client_group {
my ($self, $config, $client_group_name, $mysqld_group_name)= @_;
+
# Settings needed for client, copied from its "mysqld"
my %client_needs=
(
@@ -348,7 +358,6 @@ sub post_check_client_group {
user => '#user',
password => '#password',
);
-
my $group_to_copy_from= $config->group($mysqld_group_name);
while (my ($name_to, $name_from)= each( %client_needs )) {
my $option= $group_to_copy_from->option($name_from);
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index bdd6c7352ae..0e1e27cccd2 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -84,23 +84,34 @@ sub is_child {
my @safe_process_cmd;
my $safe_kill;
+my $bindir;
+if(defined $ENV{MTR_BINDIR})
+{
+ # This is an out-of-source build. Build directory
+ # is given in MTR_BINDIR env.variable
+ $bindir = $ENV{MTR_BINDIR}."/mysql-test";
+}
+else
+{
+ $bindir = ".";
+}
# Find the safe process binary or script
sub find_bin {
if (IS_WIN32PERL or IS_CYGWIN)
{
# Use my_safe_process.exe
- my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
+ my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe
- $safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
+ $safe_kill= my_find_bin($bindir, "lib/My/SafeProcess", "my_safe_kill");
}
else
{
# Use my_safe_process
- my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
+ my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
}
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index 97fab820f95..8a9341245be 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 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 General Public License as published by
@@ -11,7 +11,18 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
-ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
+SET(INSTALL_ARGS
+ DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess"
+ COMPONENT Test
+)
+
+IF (WIN32)
+ MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
+ MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
+ELSE()
+ MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
+ENDIF()
+
+INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
diff --git a/mysql-test/mtr.out-of-source b/mysql-test/mtr.out-of-source
new file mode 100644
index 00000000000..c2809ede136
--- /dev/null
+++ b/mysql-test/mtr.out-of-source
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+# Call mtr in out-of-source build
+$ENV{MTR_BINDIR} = "@CMAKE_BINARY_DIR@";
+chdir("@CMAKE_SOURCE_DIR@/mysql-test");
+exit(system($^X, "@CMAKE_SOURCE_DIR@/mysql-test/mysql-test-run.pl", @ARGV) >> 8); \ No newline at end of file
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 962f0553b01..b8be0f7fab5 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -95,6 +95,7 @@ $SIG{INT}= sub { mtr_error("Got ^C signal"); };
our $mysql_version_id;
our $glob_mysql_test_dir;
our $basedir;
+our $bindir;
our $path_charsetsdir;
our $path_client_bindir;
@@ -513,7 +514,7 @@ sub run_test_server ($$$) {
my $completed= [];
my %running;
my $result;
- my $exe_mysqld= find_mysqld($basedir) || ""; # Used as hint to CoreDump
+ my $exe_mysqld= find_mysqld($bindir) || ""; # Used as hint to CoreDump
my $suite_timeout= start_timer(suite_timeout());
@@ -855,7 +856,7 @@ sub run_worker ($) {
stop_all_servers($opt_shutdown_timeout);
}
if ( $opt_gprof ) {
- gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
+ gprof_collect (find_mysqld($bindir), keys %gprof_dirs);
}
exit(0);
}
@@ -1092,6 +1093,10 @@ sub command_line_setup {
$basedir= dirname($basedir);
}
+ # Respect MTR_BINDIR variable, which is typically set in to the
+ # build directory in out-of-source builds.
+ $bindir=$ENV{MTR_BINDIR}||$basedir;
+
fix_vs_config_dir();
# Look for the client binaries directory
@@ -1102,21 +1107,25 @@ sub command_line_setup {
}
else
{
- $path_client_bindir= mtr_path_exists("$basedir/client_release",
- "$basedir/client_debug",
- "$basedir/client$opt_vs_config",
- "$basedir/client",
- "$basedir/bin");
+ $path_client_bindir= mtr_path_exists("$bindir/client_release",
+ "$bindir/client_debug",
+ "$bindir/client$opt_vs_config",
+ "$bindir/client",
+ "$bindir/bin");
}
- # Look for language files and charsetsdir, use same share
- $path_language= mtr_path_exists("$basedir/share/mariadb/english",
- "$basedir/share/mysql/english",
- "$basedir/sql/share/english",
- "$basedir/share/english");
+
+ $path_language= mtr_path_exists("$bindir/share/mariadb/english",
+ "$bindir/share/mysql/english",
+ "$bindir/sql/share/english",
+ "$bindir/share/english");
my $path_share= dirname($path_language);
- $path_charsetsdir= mtr_path_exists("$path_share/charsets");
+
+ $path_charsetsdir= mtr_path_exists("$basedir/share/charsets",
+ "$basedir/share/mysql/charsets",
+ "$basedir/sql/share/charsets",
+ "$basedir/share/charsets");
if ( $opt_comment )
{
@@ -1268,7 +1277,15 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Set the "var/" directory, the base for everything else
# --------------------------------------------------------------------------
- $default_vardir= "$glob_mysql_test_dir/var";
+ if(defined $ENV{MTR_BINDIR})
+ {
+ $default_vardir= "$ENV{MTR_BINDIR}/mysql-test/var";
+ }
+ else
+ {
+ $default_vardir= "$glob_mysql_test_dir/var";
+ }
+
if ( ! $opt_vardir )
{
$opt_vardir= $default_vardir;
@@ -1339,19 +1356,6 @@ sub command_line_setup {
# --------------------------------------------------------------------------
if ( $opt_embedded_server )
{
- if ( IS_WINDOWS )
- {
- # Add the location for libmysqld.dll to the path.
- my $separator= ";";
- my $lib_mysqld=
- mtr_path_exists("$basedir/libmysqld$opt_vs_config");
- if ( IS_CYGWIN )
- {
- $lib_mysqld= posix_path($lib_mysqld);
- $separator= ":";
- }
- $ENV{'PATH'}= "$ENV{'PATH'}".$separator.$lib_mysqld;
- }
$opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
$opt_skip_ssl= 1; # Turn off use of SSL
@@ -1645,7 +1649,7 @@ sub collect_mysqld_features {
mtr_add_arg($args, "--user=root");
}
- my $exe_mysqld= find_mysqld($basedir);
+ my $exe_mysqld= find_mysqld($bindir);
my $cmd= join(" ", $exe_mysqld, @$args);
my $list= `$cmd`;
@@ -1770,7 +1774,7 @@ sub find_mysqld {
unshift(@mysqld_names, "mysqld-debug");
}
- return my_find_bin($mysqld_basedir,
+ return my_find_bin($bindir,
["sql", "libexec", "sbin", "bin"],
[@mysqld_names]);
}
@@ -1820,7 +1824,7 @@ sub executable_setup () {
if ( $opt_embedded_server )
{
$exe_mysqltest=
- mtr_exe_exists("$basedir/libmysqld/examples$opt_vs_config/mysqltest_embedded",
+ mtr_exe_exists("$bindir/libmysqld/examples$opt_vs_config/mysqltest_embedded",
"$path_client_bindir/mysqltest_embedded");
}
else
@@ -1930,11 +1934,11 @@ sub mysql_client_test_arguments(){
# mysql_client_test executable may _not_ exist
if ( $opt_embedded_server ) {
$exe= mtr_exe_maybe_exists(
- "$basedir/libmysqld/examples$opt_vs_config/mysql_client_test_embedded",
- "$basedir/bin/mysql_client_test_embedded");
+ "$bindir/libmysqld/examples$opt_vs_config/mysql_client_test_embedded",
+ "$bindir/bin/mysql_client_test_embedded");
} else {
- $exe= mtr_exe_maybe_exists("$basedir/tests$opt_vs_config/mysql_client_test",
- "$basedir/bin/mysql_client_test");
+ $exe= mtr_exe_maybe_exists("$bindir/tests$opt_vs_config/mysql_client_test",
+ "$bindir/bin/mysql_client_test");
}
my $args;
@@ -1946,13 +1950,13 @@ sub mysql_client_test_arguments(){
mtr_add_arg($args, "--testcase");
mtr_add_arg($args, "--vardir=$opt_vardir");
client_debug_arg($args,"mysql_client_test");
-
- return mtr_args2str($exe, @$args);
+ my $ret=mtr_args2str($exe, @$args);
+ return $ret;
}
sub tool_arguments ($$) {
my($sedir, $tool_name) = @_;
- my $exe= my_find_bin($basedir,
+ my $exe= my_find_bin($bindir,
[$sedir, "bin"],
$tool_name);
@@ -1966,7 +1970,7 @@ sub tool_arguments ($$) {
# scripts to run the mysqld binary to test invalid server startup options.
sub mysqld_client_arguments () {
my $default_mysqld= default_mysqld();
- my $exe = find_mysqld($basedir);
+ my $exe = find_mysqld($bindir);
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
@@ -2147,24 +2151,24 @@ sub environment_setup {
# some versions, test using it should be skipped
# ----------------------------------------------------
my $exe_bug25714=
- mtr_exe_maybe_exists("$basedir/tests$opt_vs_config/bug25714");
+ mtr_exe_maybe_exists("$bindir/tests$opt_vs_config/bug25714");
$ENV{'MYSQL_BUG25714'}= native_path($exe_bug25714);
# ----------------------------------------------------
# mysql_fix_privilege_tables.sql
# ----------------------------------------------------
my $file_mysql_fix_privilege_tables=
- mtr_file_exists("$basedir/scripts/mysql_fix_privilege_tables.sql",
- "$basedir/share/mysql_fix_privilege_tables.sql",
- "$basedir/share/mariadb/mysql_fix_privilege_tables.sql",
- "$basedir/share/mysql/mysql_fix_privilege_tables.sql");
+ mtr_file_exists("$bindir/scripts/mysql_fix_privilege_tables.sql",
+ "$bindir/share/mysql_fix_privilege_tables.sql",
+ "$bindir/share/mariadb/mysql_fix_privilege_tables.sql",
+ "$bindir/share/mysql/mysql_fix_privilege_tables.sql");
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
# ----------------------------------------------------
# my_print_defaults
# ----------------------------------------------------
my $exe_my_print_defaults=
- mtr_exe_exists("$basedir/extra$opt_vs_config/my_print_defaults",
+ mtr_exe_exists("$bindir/extra$opt_vs_config/my_print_defaults",
"$path_client_bindir/my_print_defaults");
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= native_path($exe_my_print_defaults);
@@ -2189,7 +2193,7 @@ sub environment_setup {
# mysqlhotcopy
# ----------------------------------------------------
my $mysqlhotcopy=
- mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy");
+ mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy");
# Since mysqltest interprets the real path as "false" in an if,
# use 1 ("true") to indicate "not exists" so it can be tested for
$ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1;
@@ -2197,7 +2201,7 @@ sub environment_setup {
# ----------------------------------------------------
# perror
# ----------------------------------------------------
- my $exe_perror= mtr_exe_exists("$basedir/extra$opt_vs_config/perror",
+ my $exe_perror= mtr_exe_exists("$bindir/extra$opt_vs_config/perror",
"$path_client_bindir/perror");
$ENV{'MY_PERROR'}= native_path($exe_perror);
@@ -2378,9 +2382,9 @@ sub setup_vardir() {
mkpath($plugindir);
if (IS_WINDOWS)
{
- for (<../storage/*$opt_vs_config/*.dll>,
- <../plugin/*$opt_vs_config/*.dll>,
- <../sql$opt_vs_config/*.dll>)
+ for (<$bindir/storage/*$opt_vs_config/*.dll>,
+ <$bindir/plugin/*$opt_vs_config/*.dll>,
+ <$bindir/sql$opt_vs_config/*.dll>)
{
my $pname=basename($_);
copy rel2abs($_), "$plugindir/$pname";
@@ -2389,7 +2393,7 @@ sub setup_vardir() {
}
else
{
- for (<../storage/*/.libs/*.so>,<../plugin/*/.libs/*.so>,<../sql/.libs/*.so>)
+ for (<$bindir/storage/*/.libs/*.so>,<$bindir/plugin/*/.libs/*.so>,<$bindir/sql/.libs/*.so>)
{
my $pname=basename($_);
symlink rel2abs($_), "$plugindir/$pname";
@@ -2400,8 +2404,8 @@ sub setup_vardir() {
else
{
# hm, what paths work for debs and for rpms ?
- for (<$basedir/lib/mysql/plugin/*.so>,
- <$basedir/lib/plugin/*.dll>)
+ for (<$bindir/lib/mysql/plugin/*.so>,
+ <$bindir/lib/plugin/*.dll>)
{
my $pname=basename($_);
set_plugin_var($pname);
@@ -2516,7 +2520,7 @@ sub fix_vs_config_dir () {
$opt_vs_config="";
- for (<$basedir/sql/*/mysqld.exe>) {
+ for (<$bindir/sql/*/mysqld.exe>) {
if (-M $_ < $modified)
{
$modified = -M _;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 812fd12e197..8aa121f9854 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -138,6 +138,7 @@ Tables_in_test
DROP TABLE `@`;
CREATE TABLE `я` (a INT);
SET NAMES DEFAULT;
+call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
mysqlcheck --default-character-set="latin1" --databases test
test.?
Error : Table doesn't exist
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index 986b5aba385..ce6e3dc8bf7 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -136,6 +136,7 @@ DROP TABLE `@`;
CREATE TABLE `я` (a INT);
SET NAMES DEFAULT;
+call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
--echo mysqlcheck --default-character-set="latin1" --databases test
# Error returned depends on platform, replace it with "Table doesn't exist"
--replace_result "Can't find file: './test/@003f.frm' (errno: 22)" "Table doesn't exist" "Table 'test.?' doesn't exist" "Table doesn't exist"
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 7cbd34ef1af..8068318e4c2 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -48,6 +48,4 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(mysys ${MYSYS_SOURCES})
-
- INSTALL(TARGETS mysys DESTINATION lib/opt COMPONENT runtime) # TODO: Component?
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt
index 109b8d46a36..440be4d2f12 100755
--- a/regex/CMakeLists.txt
+++ b/regex/CMakeLists.txt
@@ -20,6 +20,4 @@ SET(REGEX_SOURCES regcomp.c regerror.c regexec.c regfree.c reginit.c)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(regex ${REGEX_SOURCES})
-
- INSTALL(TARGETS regex DESTINATION lib/opt COMPONENT runtime) # TODO: Component
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index eee70fdf776..a62569843db 100755
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -14,10 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Build mysql_fix_privilege_tables.sql
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql
- COMMAND copy /b
- mysql_system_tables.sql + mysql_system_tables_fix.sql
- mysql_fix_privilege_tables.sql
+FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
+ native_outfile )
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables.sql
+ COMMAND COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
+ cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql
+ ${native_outfile}
DEPENDS
${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables.sql
${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables_fix.sql)
@@ -29,24 +31,26 @@ TARGET_LINK_LIBRARIES(comp_sql debug dbug mysys strings)
# Use comp_sql to build mysql_fix_privilege_tables_sql.c
GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables_sql.c
COMMAND ${COMP_SQL_EXE}
mysql_fix_privilege_tables
- mysql_fix_privilege_tables.sql
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
mysql_fix_privilege_tables_sql.c
- DEPENDS comp_sql ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql)
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS comp_sql
+ ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables.sql)
# Add dummy target for the above to be built
ADD_CUSTOM_TARGET(GenFixPrivs
ALL
- DEPENDS ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c)
+ DEPENDS ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables_sql.c)
# ----------------------------------------------------------------------
# Replace some variables @foo@ in the .in/.sh file, and write the new script
# ----------------------------------------------------------------------
SET(CFLAGS "-D_WINDOWS ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
-SET(prefix "${CMAKE_INSTALL_PREFIX}/MySQL Server ${MYSQL_BASE_VERSION}")
+SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(sysconfdir ${prefix})
SET(bindir ${prefix}/bin)
SET(libexecdir ${prefix}/bin)
@@ -76,11 +80,14 @@ CONFIGURE_FILE(mysqldumpslow.sh
CONFIGURE_FILE(mysqlhotcopy.sh
${CMAKE_BINARY_DIR}/scripts/mysqlhotcopy.pl ESCAPE_QUOTES @ONLY)
-INSTALL(FILES mysqldumpslow.pl mysqlhotcopy.pl mysql_config.pl
+FOREACH(f mysqldumpslow.pl mysqlhotcopy.pl mysql_config.pl
mysql_convert_table_format.pl mysql_install_db.pl
- mysql_secure_installation.pl mysqld_multi.pl
- DESTINATION scripts COMPONENT scripts)
-
-INSTALL(FILES fill_help_tables.sql mysql_fix_privilege_tables.sql mysql_system_tables.sql
- mysql_system_tables_data.sql mysql_system_tables_fix.sql mysql_test_data_timezone.sql
- DESTINATION share COMPONENT scripts)
+ mysql_secure_installation.pl mysqld_multi.pl)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f}
+ DESTINATION scripts COMPONENT Server_Scripts)
+ENDFOREACH()
+
+INSTALL(FILES fill_help_tables.sql mysql_system_tables.sql
+ mysql_system_tables_data.sql mysql_system_tables_fix.sql mysql_test_data_timezone.sql
+ DESTINATION share COMPONENT Server)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql DESTINATION share COMPONENT Server) \ No newline at end of file
diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c
index 88e88e632b6..f65517ccf19 100644
--- a/scripts/comp_sql.c
+++ b/scripts/comp_sql.c
@@ -25,6 +25,10 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/stat.h>
+
+/* Compiler-dependent constant for maximum string constant */
+#define MAX_STRING_CONSTANT_LENGTH 65535
FILE *in, *out;
@@ -58,64 +62,99 @@ static void die(const char *fmt, ...)
int main(int argc, char *argv[])
{
char buff[512];
+ struct stat st;
char* struct_name= argv[1];
char* infile_name= argv[2];
char* outfile_name= argv[3];
+
if (argc != 4)
die("Usage: comp_sql <struct_name> <sql_filename> <c_filename>");
/* Open input and output file */
if (!(in= fopen(infile_name, "r")))
die("Failed to open SQL file '%s'", infile_name);
+
+
if (!(out= fopen(outfile_name, "w")))
die("Failed to open output file '%s'", outfile_name);
+ fprintf(out, "const char %s[]={\n",struct_name);
+
+ /*
+ Some compilers have limitations how long a string constant can be.
+ We'll output very long strings as hexadecimal arrays, and short ones
+ as strings (prettier)
+ */
+ stat(infile_name, &st);
+ if (st.st_size > MAX_STRING_CONSTANT_LENGTH)
+ {
+ int cnt=0;
+ int c;
+ int first_char= 1;
+ for(cnt=0;;cnt++)
+ {
+ c= fgetc(in);
+ if (c== -1)
+ break;
+
+ if(cnt != 0)
+ fputc(',', out);
- fprintf(out, "const char* %s={\n\"", struct_name);
+ /* Put line break after each 16 hex characters */
+ if(cnt && (cnt%16 == 0))
+ fputc('\n', out);
- while (fgets(buff, sizeof(buff), in))
+ fprintf(out,"0x%02x",c);
+ }
+ fprintf(out,",0x00",c);
+ }
+ else
{
- char *curr= buff;
- while (*curr)
+ fprintf(out,"\"");
+ while (fgets(buff, sizeof(buff), in))
{
- if (*curr == '\n')
- {
- /*
- Reached end of line, add escaped newline, escaped
- backslash and a newline to outfile
- */
- fprintf(out, "\\n \"\n\"");
- curr++;
- }
- else if (*curr == '\r')
- {
- curr++; /* Skip */
- }
- else
+ char *curr= buff;
+ while (*curr)
{
- if (*curr == '"')
+ if (*curr == '\n')
{
- /* Needs escape */
- fputc('\\', out);
+ /*
+ Reached end of line, add escaped newline, escaped
+ backslash and a newline to outfile
+ */
+ fprintf(out, "\\n \"\n\"");
+ curr++;
+ }
+ else if (*curr == '\r')
+ {
+ curr++; /* Skip */
+ }
+ else
+ {
+ if (*curr == '"')
+ {
+ /* Needs escape */
+ fputc('\\', out);
+ }
+
+ fputc(*curr, out);
+ curr++;
}
-
- fputc(*curr, out);
- curr++;
+ }
+ if (*(curr-1) != '\n')
+ {
+ /*
+ Some compilers have a max string length,
+ insert a newline at every 512th char in long
+ strings
+ */
+ fprintf(out, "\"\n\"");
}
}
- if (*(curr-1) != '\n')
- {
- /*
- Some compilers have a max string length,
- insert a newline at every 512th char in long
- strings
- */
- fprintf(out, "\"\n\"");
- }
+ fprintf(out, "\\\n\"");
}
-
- fprintf(out, "\\\n\"};\n");
-
+
+ fprintf(out, "};\n");
fclose(in);
fclose(out);
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in
index 18bd713c041..0985c27f0ec 100644
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@ -360,7 +360,7 @@ my $hostname = hostname();
my $resolved;
if ( !$opt->{'cross-bootstrap'} and !$opt->{rpm} and !$opt->{force} )
{
- my $resolveip;
+ my $resolveip = $bindir/resolveip;
$resolved = `$resolveip $hostname 2>&1`;
if ( $? != 0 )
@@ -418,9 +418,7 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap,
"--bootstrap",
"--basedir=$opt->{basedir}",
"--datadir=$opt->{ldata}",
- "--skip-innodb",
- "--skip-bdb",
- "--skip-ndbcluster",
+ "--loose-skip-innodb",
"--max_allowed_packet=8M",
"--net_buffer_length=16K",
@args,
diff --git a/server-tools/instance-manager/CMakeLists.txt b/server-tools/instance-manager/CMakeLists.txt
index 54389a6f3cc..8e96a3f6425 100755
--- a/server-tools/instance-manager/CMakeLists.txt
+++ b/server-tools/instance-manager/CMakeLists.txt
@@ -34,5 +34,3 @@ TARGET_LINK_LIBRARIES(mysqlmanager debug dbug mysys strings taocrypt vio yassl z
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("mysqlmanager" "asInvoker")
ENDIF(EMBED_MANIFESTS)
-
-INSTALL(TARGETS mysqlmanager DESTINATION bin COMPONENT runtime)
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 9ba6bd1e1b4..1fd64e8fc76 100755
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -21,17 +21,19 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/zlib
- ${CMAKE_SOURCE_DIR}/extra/libevent
+ ${CMAKE_SOURCE_DIR}/extra/libevent
+ ${CMAKE_BINARY_DIR}/extra/libevent
+ ${CMAKE_CURRENT_BINARY_DIR}
)
-SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
- ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
- ${CMAKE_SOURCE_DIR}/include/mysql_version.h
- ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
- ${CMAKE_SOURCE_DIR}/sql/lex_hash.h
- ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
- ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
- ${PROJECT_SOURCE_DIR}/include/sql_state.h
+SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
+ ${CMAKE_BINARY_DIR}/include/mysql_version.h
+ ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
+ ${CMAKE_BINARY_DIR}/sql/lex_hash.h
+ ${CMAKE_BINARY_DIR}/include/mysqld_error.h
+ ${CMAKE_BINARY_DIR}/include/mysqld_ername.h
+ ${CMAKE_BINARY_DIR}/include/sql_state.h
PROPERTIES GENERATED 1)
ADD_DEFINITIONS(-DMYSQL_SERVER -D_CONSOLE -DHAVE_DLOPEN -DHAVE_EVENT_SCHEDULER)
@@ -74,20 +76,22 @@ SET (SQL_SOURCE
sql_connect.cc scheduler.cc
sql_profile.cc event_parse_data.cc opt_table_elimination.cc
create_options.cc
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
- ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
- ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
- ${PROJECT_SOURCE_DIR}/include/sql_state.h
- ${PROJECT_SOURCE_DIR}/include/mysql_version.h
- ${PROJECT_SOURCE_DIR}/sql/sql_builtin.cc
- ${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
+ ${CMAKE_BINARY_DIR}/include/mysqld_error.h
+ ${CMAKE_BINARY_DIR}/include/mysqld_ername.h
+ ${CMAKE_BINARY_DIR}/include/sql_state.h
+ ${CMAKE_BINARY_DIR}/include/mysql_version.h
+ ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
+ ${CMAKE_BINARY_DIR}/sql/lex_hash.h)
ADD_LIBRARY(sql ${SQL_SOURCE})
-IF (NOT EXISTS cmake_dummy.cc)
- FILE (WRITE cmake_dummy.cc "")
-ENDIF (NOT EXISTS cmake_dummy.cc)
-ADD_EXECUTABLE(mysqld cmake_dummy.cc message.rc)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/cmake/dummy.in cmake_dummy.cc COPYONLY)
+MYSQL_ADD_EXECUTABLE(mysqld cmake_dummy.cc message.rc DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
+INSTALL_DEBUG_TARGET(mysqld
+ DESTINATION ${INSTALL_SBINDIR}
+ PDB_DESTINATION ${INSTALL_SBINDIR}/debug
+ RENAME mysqld-debug)
SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX})
SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
@@ -111,17 +115,17 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK
COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js
${PLATFORM} ${LIB_LOCATIONS} > mysqld.def
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/sql)
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
ADD_DEPENDENCIES(sql GenError)
# Sql Parser custom command
ADD_CUSTOM_COMMAND(
- OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
+ OUTPUT ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
COMMAND bison ARGS -y -p MYSQL --defines=sql_yacc.h
- --output=sql_yacc.cc sql_yacc.yy
+ --output=sql_yacc.cc "${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy"
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy)
@@ -130,17 +134,15 @@ ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
TARGET_LINK_LIBRARIES(gen_lex_hash debug dbug mysqlclient strings wsock32)
GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
ADD_CUSTOM_COMMAND(
- OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h
+ OUTPUT ${CMAKE_BINARY_DIR}/sql/lex_hash.h
COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
DEPENDS ${GEN_LEX_HASH_EXE})
ADD_CUSTOM_TARGET(
GenServerSource ALL
- DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
- ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
- ${PROJECT_SOURCE_DIR}/sql/message.h
- ${PROJECT_SOURCE_DIR}/sql/message.rc
- ${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
+ DEPENDS ${CMAKE_BINARY_DIR}/sql/sql_yacc.h
+ ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
+ ${CMAKE_BINARY_DIR}/sql/lex_hash.h)
ADD_DEPENDENCIES(mysqld GenServerSource)
@@ -152,7 +154,88 @@ ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
ADD_DEPENDENCIES(udf_example strings GenError)
TARGET_LINK_LIBRARIES(udf_example strings wsock32)
-INSTALL(TARGETS mysqld
- RUNTIME DESTINATION bin COMPONENT runtime
- LIBRARY DESTINATION lib COMPONENT runtime
- ARCHIVE DESTINATION lib COMPONENT runtime)
+ADD_SUBDIRECTORY(share)
+
+IF(WIN32)
+ SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql)
+ FILE(TO_NATIVE_PATH ${my_bootstrap_sql} native_outfile)
+
+ # Create bootstrapper SQL script
+ ADD_CUSTOM_COMMAND(OUTPUT
+ ${my_bootstrap_sql}
+ COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts
+ cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql ${native_outfile}
+ DEPENDS
+ ${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql
+ ${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql
+ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql
+ )
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
+ COMMAND comp_sql
+ mysql_bootstrap_sql
+ ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql
+ mysql_bootstrap_sql.c
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS comp_sql ${my_bootstrap_sql})
+
+ MYSQL_ADD_EXECUTABLE(mysql_install_db
+ mysql_install_db.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
+ COMPONENT Server)
+ TARGET_LINK_LIBRARIES(mysql_install_db mysys strings dbug)
+
+ MYSQL_ADD_EXECUTABLE(mysql_upgrade_service
+ mysql_upgrade_service.cc
+ COMPONENT Server)
+ TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys strings dbug)
+
+ # mysql_install_db should be in the same directory as mysqld
+ # to work correctly
+ GET_TARGET_PROPERTY(MYSQLD_EXECUTABLE mysqld LOCATION)
+ IF(NOT MYSQLD_EXECUTABLE)
+ MESSAGE(FATAL_ERROR "Unexpected")
+ ENDIF()
+ENDIF()
+
+# We need to create empty directories (data/test) the installation.
+# This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767
+# Avoid completely empty directories and install dummy file instead.
+SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty )
+FILE(WRITE ${DUMMY_FILE} "")
+INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test COMPONENT DataFiles)
+
+# Install initial database on windows
+IF(NOT CMAKE_CROSSCOMPILING)
+ GET_TARGET_PROPERTY(MYSQLD_EXECUTABLE mysqld LOCATION)
+ENDIF()
+IF(WIN32 AND MYSQLD_EXECUTABLE)
+ CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/win/cmake/create_initial_db.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
+ @ONLY
+ )
+
+ IF(MSVC_IDE OR CMAKE_GENERATOR MATCHES "Xcode")
+ SET (CONFIG_PARAM -DCONFIG=${CMAKE_CFG_INTDIR})
+ ENDIF()
+ MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT initdb.dep
+ COMMAND ${CMAKE_COMMAND}
+ ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
+ DEPENDS mysqld
+ )
+ ADD_CUSTOM_TARGET(initial_database
+ ALL
+ DEPENDS initdb.dep
+ )
+ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
+ COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE)
+ELSE()
+ # Not windows or cross compiling, just install an empty directory
+ INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)
+ENDIF()
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 1c3ee09c0d5..899795aa709 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -151,7 +151,7 @@ DEFS = -DMYSQL_SERVER \
BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
- nt_servc.cc nt_servc.h \
+ nt_servc.cc nt_servc.h mysql_install_db.cc mysql_upgrade_service.cc \
message.mc message.h message.rc MSG00001.bin \
CMakeLists.txt
diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt
new file mode 100644
index 00000000000..0c8ddf402d2
--- /dev/null
+++ b/sql/share/CMakeLists.txt
@@ -0,0 +1,54 @@
+# Copyright (c) 2006, 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 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+SET (dirs
+danish
+german
+slovak
+dutch
+greek
+norwegian
+spanish
+english
+hungarian
+norwegian-ny
+swedish
+italian
+polish
+ukrainian
+japanese
+portuguese
+romanian
+estonian
+korean
+russian
+czech
+french
+serbian
+)
+
+SET(files
+ errmsg.txt
+)
+
+FOREACH (dir ${dirs})
+ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir}
+ DESTINATION share COMPONENT Server)
+ENDFOREACH()
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION share COMPONENT Server
+ PATTERN "languages.html" EXCLUDE
+)
+
+INSTALL(FILES ${files} DESTINATION share COMPONENT Server)
diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am
index cb7cc2224a8..8b89d3e55ac 100644
--- a/sql/share/Makefile.am
+++ b/sql/share/Makefile.am
@@ -15,7 +15,7 @@
## Process this file with automake to create Makefile.in
-EXTRA_DIST= errmsg.txt
+EXTRA_DIST= errmsg.txt CMakeLists.txt
dist-hook:
for dir in charsets @AVAILABLE_LANGUAGES@; do \
diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt
index 7724f9c5311..6ffc8d992b4 100644
--- a/storage/maria/CMakeLists.txt
+++ b/storage/maria/CMakeLists.txt
@@ -48,23 +48,25 @@ SET(ARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
MYSQL_STORAGE_ENGINE(ARIA)
IF(NOT SOURCE_SUBLIBS)
+
ADD_DEPENDENCIES(aria GenError)
-ADD_EXECUTABLE(aria_ftdump maria_ftdump.c)
+MYSQL_ADD_EXECUTABLE(aria_ftdump maria_ftdump.c)
TARGET_LINK_LIBRARIES(aria_ftdump aria myisam mysys dbug strings zlib wsock32)
-ADD_EXECUTABLE(aria_chk maria_chk.c)
+MYSQL_ADD_EXECUTABLE(aria_chk maria_chk.c)
TARGET_LINK_LIBRARIES(aria_chk aria myisam mysys dbug strings zlib wsock32)
-ADD_EXECUTABLE(aria_read_log maria_read_log.c)
+MYSQL_ADD_EXECUTABLE(aria_read_log maria_read_log.c)
TARGET_LINK_LIBRARIES(aria_read_log aria myisam mysys dbug strings zlib wsock32)
-ADD_EXECUTABLE(aria_pack maria_pack.c)
+MYSQL_ADD_EXECUTABLE(aria_pack maria_pack.c)
TARGET_LINK_LIBRARIES(aria_pack aria myisam mysys dbug strings zlib wsock32)
-ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c)
+MYSQL_ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c)
TARGET_LINK_LIBRARIES(aria_dump_log aria myisam mysys dbug strings zlib wsock32)
+
ADD_EXECUTABLE(ma_test1 ma_test1.c)
TARGET_LINK_LIBRARIES(ma_test1 aria myisam mysys dbug strings zlib wsock32)
@@ -79,15 +81,4 @@ TARGET_LINK_LIBRARIES(ma_rt_test aria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(ma_sp_test ma_sp_test.c)
TARGET_LINK_LIBRARIES(ma_sp_test aria myisam mysys dbug strings zlib wsock32)
-
-IF(EMBED_MANIFESTS)
- MYSQL_EMBED_MANIFEST("aria_ftdump" "asInvoker")
- MYSQL_EMBED_MANIFEST("aria_chk" "asInvoker")
- MYSQL_EMBED_MANIFEST("aria_read_log" "asInvoker")
- MYSQL_EMBED_MANIFEST("aria_pack" "asInvoker")
-ENDIF(EMBED_MANIFESTS)
-
-INSTALL(TARGETS aria_ftdump aria_chk aria_read_log aria_pack aria_dump_log
- DESTINATION bin COMPONENT runtime)
-
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt
index 2d0d1bca7a4..e7e3de64cf3 100644
--- a/storage/myisam/CMakeLists.txt
+++ b/storage/myisam/CMakeLists.txt
@@ -31,16 +31,16 @@ SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
MYSQL_STORAGE_ENGINE(MYISAM)
IF(NOT SOURCE_SUBLIBS)
- ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
+ MYSQL_ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys debug dbug strings zlib wsock32)
- ADD_EXECUTABLE(myisamchk myisamchk.c)
+ MYSQL_ADD_EXECUTABLE(myisamchk myisamchk.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisamchk myisam mysys debug dbug strings zlib wsock32)
- ADD_EXECUTABLE(myisamlog myisamlog.c)
+ MYSQL_ADD_EXECUTABLE(myisamlog myisamlog.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisamlog myisam mysys debug dbug strings zlib wsock32)
- ADD_EXECUTABLE(myisampack myisampack.c)
+ MYSQL_ADD_EXECUTABLE(myisampack myisampack.c DESTINATION bin)
TARGET_LINK_LIBRARIES(myisampack myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(mi_test1 mi_test1.c)
@@ -60,13 +60,4 @@ IF(NOT SOURCE_SUBLIBS)
SET_TARGET_PROPERTIES(myisamchk myisampack PROPERTIES LINK_FLAGS "setargv.obj")
- IF(EMBED_MANIFESTS)
- MYSQL_EMBED_MANIFEST("myisam_ftdump" "asInvoker")
- MYSQL_EMBED_MANIFEST("myisamchk" "asInvoker")
- MYSQL_EMBED_MANIFEST("myisamlog" "asInvoker")
- MYSQL_EMBED_MANIFEST("myisampack" "asInvoker")
- ENDIF(EMBED_MANIFESTS)
-
- INSTALL(TARGETS myisam_ftdump myisamchk myisamlog myisampack DESTINATION bin COMPONENT runtime)
-
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/storage/mysql_storage_engine.cmake b/storage/mysql_storage_engine.cmake
index 5424beca33a..e500526350b 100644
--- a/storage/mysql_storage_engine.cmake
+++ b/storage/mysql_storage_engine.cmake
@@ -16,7 +16,10 @@ IF(NOT SOURCE_SUBLIBS)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
- ${CMAKE_SOURCE_DIR}/extra/yassl/include)
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_BINARY_DIR}/include
+ ${CMAKE_BINARY_DIR}/sql
+ )
STRING(TOUPPER ${engine} engine)
STRING(TOLOWER ${engine} libname)
IF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
@@ -33,13 +36,13 @@ IF(NOT SOURCE_SUBLIBS)
#Create a DLL.The name of the dll is ha_<storage_engine>.dll
#The dll is linked to the mysqld executable
SET(dyn_libname ha_${libname})
- ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
- TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld)
+ ADD_LIBRARY(${dyn_libname} MODULE ${${engine}_SOURCES})
+ TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld)
IF(${engine}_LIBS)
TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
ENDIF(${engine}_LIBS)
# Install the plugin
- INSTALL(TARGETS ${dyn_libname} DESTINATION lib/plugin COMPONENT runtime)
+ MYSQL_INSTALL_TARGETS(${dyn_libname} DESTINATION lib/plugin COMPONENT Server)
MESSAGE("build ${engine} as DLL")
ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
index 3e13a93c4c9..bdea64c755a 100755
--- a/strings/CMakeLists.txt
+++ b/strings/CMakeLists.txt
@@ -28,6 +28,4 @@ SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(strings ${STRINGS_SOURCES})
-
- INSTALL(TARGETS strings DESTINATION lib/opt COMPONENT runtime) # TODO: Component
ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 30afebb46bd..4095f2ec342 100755
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -25,4 +25,4 @@ TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient_notls wsock32)
ADD_EXECUTABLE(bug25714 bug25714.c)
TARGET_LINK_LIBRARIES(bug25714 mysqlclient_notls wsock32)
-INSTALL(TARGETS mysql_client_test bug25714 DESTINATION bin COMPONENT runtime)
+INSTALL(TARGETS mysql_client_test DESTINATION bin COMPONENT Test)
diff --git a/win/Makefile.am b/win/Makefile.am
index 19a1b6a64d6..b657acfd65c 100644
--- a/win/Makefile.am
+++ b/win/Makefile.am
@@ -18,5 +18,39 @@ EXTRA_DIST = build-vs71.bat build-vs8.bat build-vs8_x64.bat build-vs9.bat \
build-vs9_x64.bat configure.js README mysql_manifest.cmake \
create_manifest.js create_def_file.js build-nmake.bat \
build-nmake-x64.bat configure-mariadb.sh make_mariadb_win_dist \
- build-vs10.bat build-vs10_x64.bat
-
+ build-vs10.bat build-vs10_x64.bat \
+ cmake/cmake_parse_arguments.cmake \
+ cmake/cpack_source_ignore_files.cmake \
+ cmake/create_initial_db.cmake.in \
+ cmake/install_layout.cmake \
+ cmake/install_macros.cmake \
+ cmake/mysql_add_executable.cmake \
+ cmake/mysql_version.cmake \
+ cmake/package_name.cmake \
+ cmake/versioninfo.rc.in \
+ cmake/dummy.in \
+ packaging/CMakeLists.txt \
+ packaging/CPackWixConfig.cmake \
+ packaging/create_msi.cmake.in \
+ packaging/custom_ui.wxs \
+ packaging/extra.wxs.in \
+ packaging/COPYING.rtf \
+ packaging/mysql_server.wxs.in \
+ packaging/ca/CMakeLists.txt \
+ packaging/ca/CustomAction.cpp \
+ packaging/ca/CustomAction.def \
+ packaging/ca/CustomAction.rc \
+ packaging/WixUIBannerBmp.jpg \
+ packaging/WixUIDialogBmp.jpg \
+ upgrade_wizard/resource.h \
+ upgrade_wizard/stdafx.h \
+ upgrade_wizard/targetver.h \
+ upgrade_wizard/upgrade.cpp \
+ upgrade_wizard/upgrade.h \
+ upgrade_wizard/upgrade.rc \
+ upgrade_wizard/upgradeDlg.cpp \
+ upgrade_wizard/upgradeDlg.h \
+ upgrade_wizard/upgrade_wizard.exe.manifest \
+ upgrade_wizard/CMakeLists.txt \
+ upgrade_wizard/res/upgrade.ico \
+ upgrade_wizard/res/upgrade.rc2
diff --git a/win/build_maria_release.bat b/win/build_maria_release.bat
new file mode 100644
index 00000000000..c5b1bb915c2
--- /dev/null
+++ b/win/build_maria_release.bat
@@ -0,0 +1,47 @@
+set build_64_bit=
+set build_msi=
+set generator=
+set scriptdir=%~dp0
+
+:: Process all the arguments from the command line
+::
+:process_arguments
+ if "%~1"=="" goto :do_work
+ if "%~1"=="-h" goto :help
+ if "%~1"=="-msi" set build_msi=1
+ if "%~1"=="-G" set generator=-G "%~2"
+ shift
+ goto :process_arguments
+
+:help
+ echo "build_maria_release [-h] [-msi] [-G <Generator>]"
+
+:die
+ echo error occured.
+ popd
+ exit /b 1
+
+:do_work
+:: We're doing out-of-source build to ensure nobody has broken it:)
+
+ pushd %scriptdir%
+ cd ..
+ rd /s /q xxx
+ mkdir xxx
+ cd xxx
+
+ cmake .. -DWITH_EMBEDDED_SERVER=1 %generator%
+ if %ERRORLEVEL% NEQ 0 goto :die
+ cmake --build . --config Debug
+ if %ERRORLEVEL% NEQ 0 goto :die
+ cmake --build . --config RelWithDebInfo --target package
+ if %ERRORLEVEL% NEQ 0 goto :die
+
+
+ if "%build_msi%"=="1" (
+ cmake --build . --config RelWithDebInfo --target win\packaging\msi
+ if %ERRORLEVEL% NEQ 0 goto :die
+ )
+ xcopy /y *.zip ..
+ xcopy /y *.msi ..
+ popd \ No newline at end of file
diff --git a/win/cmake/cmake_parse_arguments.cmake b/win/cmake/cmake_parse_arguments.cmake
new file mode 100644
index 00000000000..db540ae9020
--- /dev/null
+++ b/win/cmake/cmake_parse_arguments.cmake
@@ -0,0 +1,47 @@
+
+# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems,Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Handy macro to parse macro arguments
+MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names)
+ SET(DEFAULT_ARGS)
+ FOREACH(arg_name ${arg_names})
+ SET(${prefix}_${arg_name})
+ ENDFOREACH(arg_name)
+ FOREACH(option ${option_names})
+ SET(${prefix}_${option} FALSE)
+ ENDFOREACH(option)
+
+ SET(current_arg_name DEFAULT_ARGS)
+ SET(current_arg_list)
+ FOREACH(arg ${ARGN})
+ SET(larg_names ${arg_names})
+ LIST(FIND larg_names "${arg}" is_arg_name)
+ IF (is_arg_name GREATER -1)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ SET(current_arg_name ${arg})
+ SET(current_arg_list)
+ ELSE (is_arg_name GREATER -1)
+ SET(loption_names ${option_names})
+ LIST(FIND loption_names "${arg}" is_option)
+ IF (is_option GREATER -1)
+ SET(${prefix}_${arg} TRUE)
+ ELSE (is_option GREATER -1)
+ SET(current_arg_list ${current_arg_list} ${arg})
+ ENDIF (is_option GREATER -1)
+ ENDIF (is_arg_name GREATER -1)
+ ENDFOREACH(arg)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO() \ No newline at end of file
diff --git a/win/cmake/cpack_source_ignore_files.cmake b/win/cmake/cpack_source_ignore_files.cmake
new file mode 100644
index 00000000000..5eef20dccc6
--- /dev/null
+++ b/win/cmake/cpack_source_ignore_files.cmake
@@ -0,0 +1,40 @@
+SET(CPACK_SOURCE_IGNORE_FILES
+\\\\.bzr/
+\\\\.bzr-mysql
+\\\\.bzrignore
+CMakeCache\\\\.txt
+cmake_dist\\\\.cmake
+CPackSourceConfig\\\\.cmake
+CPackConfig.cmake
+/cmake_install\\\\.cmake
+/CTestTestfile\\\\.cmake
+/CMakeFiles/
+/version_resources/
+/_CPack_Packages/
+$\\\\.gz
+$\\\\.zip
+/CMakeFiles/
+/version_resources/
+/_CPack_Packages/
+scripts/make_binary_distribution$
+scripts/msql2mysql$
+scripts/mysql_config$
+scripts/mysql_convert_table_format$
+scripts/mysql_find_rows$
+scripts/mysql_fix_extensions$
+scripts/mysql_install_db$
+scripts/mysql_secure_installation$
+scripts/mysql_setpermission$
+scripts/mysql_zap$
+scripts/mysqlaccess$
+scripts/mysqld_multi$
+scripts/mysqld_safe$
+scripts/mysqldumpslow$
+scripts/mysqlhotcopy$
+Makefile$
+include/config\\\\.h$
+include/my_config\\\\.h$
+/autom4te\\\\.cache/
+errmsg\\\\.sys$
+#
+)
diff --git a/win/cmake/create_initial_db.cmake.in b/win/cmake/create_initial_db.cmake.in
new file mode 100644
index 00000000000..f2b8c67bcf2
--- /dev/null
+++ b/win/cmake/create_initial_db.cmake.in
@@ -0,0 +1,84 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This script creates initial database for packaging on Windows
+SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
+SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
+SET(MYSQLD_EXECUTABLE "@MYSQLD_EXECUTABLE@")
+SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
+SET(WIN32 "@WIN32@")
+# Force Visual Studio to output to stdout
+IF(ENV{VS_UNICODE_OUTPUT})
+ SET ($ENV{VS_UNICODE_OUTPUT})
+ENDIF()
+IF(CMAKE_CFG_INTDIR AND CONFIG)
+ #Resolve build configuration variables
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" ${CONFIG} MYSQLD_EXECUTABLE
+ "${MYSQLD_EXECUTABLE}")
+ENDIF()
+
+# Create bootstrapper SQL script
+FILE(WRITE bootstrap.sql "use mysql;\n" )
+FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql)
+ FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
+ FOREACH(STR ${CONTENTS})
+ IF(NOT STR MATCHES "@current_hostname")
+ FILE(APPEND bootstrap.sql "${STR}\n")
+ ENDIF()
+ ENDFOREACH()
+ENDFOREACH()
+FILE(READ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql CONTENTS)
+FILE(APPEND bootstrap.sql ${CONTENTS})
+
+
+FILE(REMOVE_RECURSE mysql)
+MAKE_DIRECTORY(mysql)
+IF(WIN32)
+ SET(CONSOLE --console)
+ENDIF()
+
+SET(BOOTSTRAP_COMMAND
+ ${MYSQLD_EXECUTABLE}
+ --no-defaults
+ ${CONSOLE}
+ --bootstrap
+ --language=${CMAKE_CURRENT_BINARY_DIR}/share/english
+ --basedir=.
+ --datadir=.
+ --default-storage-engine=MyISAM
+ --loose-skip-innodb
+ --loose-skip-pbxt
+ --loose-skip-ndbcluster
+ --max_allowed_packet=8M
+ --net_buffer_length=16K
+)
+
+GET_FILENAME_COMPONENT(CWD . ABSOLUTE)
+EXECUTE_PROCESS(
+ COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND}
+)
+EXECUTE_PROCESS (
+ COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD}
+)
+EXECUTE_PROCESS (
+ COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT
+ ERROR_VARIABLE ERR
+ RESULT_VARIABLE RESULT
+ )
+
+IF(NOT RESULT EQUAL 0)
+ MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
+ENDIF()
+
diff --git a/win/cmake/install_layout.cmake b/win/cmake/install_layout.cmake
new file mode 100644
index 00000000000..601e208d96d
--- /dev/null
+++ b/win/cmake/install_layout.cmake
@@ -0,0 +1,223 @@
+# Copyright (C) 2010 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# The purpose of this file is to set the default installation layout.
+#
+# The current choices of installation layout are:
+#
+# STANDALONE
+# Build with prefix=/usr/local/mysql, create tarball with install prefix="."
+# and relative links. Windows zip uses the same tarball layout but without
+# the build prefix.
+#
+# RPM
+# Build as per default RPM layout, with prefix=/usr
+#
+# DEB
+# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor
+#
+# SVR4
+# Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql
+#
+# To force a directory layout, use -DINSTALL_LAYOUT=<layout>.
+#
+# The default is STANDALONE.
+#
+# There is the possibility to further fine-tune installation directories.
+# Several variables can be overwritten:
+#
+# - INSTALL_BINDIR (directory with client executables and scripts)
+# - INSTALL_SBINDIR (directory with mysqld)
+# - INSTALL_SCRIPTDIR (several scripts, rarely used)
+#
+# - INSTALL_LIBDIR (directory with client end embedded libraries)
+# - INSTALL_PLUGINDIR (directory for plugins)
+#
+# - INSTALL_INCLUDEDIR (directory for MySQL headers)
+#
+# - INSTALL_DOCDIR (documentation)
+# - INSTALL_DOCREADMEDIR (readme and similar)
+# - INSTALL_MANDIR (man pages)
+# - INSTALL_INFODIR (info pages)
+#
+# - INSTALL_SHAREDIR (location of aclocal/mysql.m4)
+# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages)
+# - INSTALL_MYSQLTESTDIR (mysql-test)
+# - INSTALL_SQLBENCHDIR (sql-bench)
+# - INSTALL_SUPPORTFILESDIR (various extra support files)
+#
+# - INSTALL_MYSQLDATADIR (data directory)
+#
+# When changing this page, _please_ do not forget to update public Wiki
+# http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths
+
+IF(NOT INSTALL_LAYOUT)
+ SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
+ENDIF()
+
+SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
+CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4")
+
+IF(UNIX)
+ IF(INSTALL_LAYOUT MATCHES "RPM")
+ SET(default_prefix "/usr")
+ ELSEIF(INSTALL_LAYOUT MATCHES "DEB")
+ SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}")
+ # This is required to avoid "cpack -GDEB" default of prefix=/usr
+ SET(CPACK_SET_DESTDIR ON)
+ ELSEIF(INSTALL_LAYOUT MATCHES "SVR4")
+ SET(default_prefix "/opt/mysql/mysql")
+ ELSE()
+ SET(default_prefix "/usr/local/mysql")
+ ENDIF()
+ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX ${default_prefix}
+ CACHE PATH "install prefix" FORCE)
+ ENDIF()
+ SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4")
+ LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind)
+ IF(ind EQUAL -1)
+ MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}."
+ " Choose between ${VALID_INSTALL_LAYOUTS}" )
+ ENDIF()
+
+ SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
+ CACHE PATH "config directory (for my.cnf)")
+ MARK_AS_ADVANCED(SYSCONFDIR)
+ENDIF()
+
+#
+# STANDALONE layout
+#
+SET(INSTALL_BINDIR_STANDALONE "bin")
+SET(INSTALL_SBINDIR_STANDALONE "bin")
+SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
+#
+SET(INSTALL_LIBDIR_STANDALONE "lib")
+SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_STANDALONE "include")
+#
+SET(INSTALL_DOCDIR_STANDALONE "docs")
+SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
+SET(INSTALL_MANDIR_STANDALONE "man")
+SET(INSTALL_INFODIR_STANDALONE "docs")
+#
+SET(INSTALL_SHAREDIR_STANDALONE "share")
+SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share")
+SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test")
+SET(INSTALL_SQLBENCHDIR_STANDALONE ".")
+SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
+
+#
+# RPM layout
+#
+SET(INSTALL_BINDIR_RPM "bin")
+SET(INSTALL_SBINDIR_RPM "sbin")
+SET(INSTALL_SCRIPTDIR_RPM "bin")
+#
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ SET(INSTALL_LIBDIR_RPM "lib64")
+ SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin")
+ELSE()
+ SET(INSTALL_LIBDIR_RPM "lib")
+ SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin")
+ENDIF()
+#
+SET(INSTALL_INCLUDEDIR_RPM "include/mysql")
+#
+#SET(INSTALL_DOCDIR_RPM unset - installed directly by RPM)
+#SET(INSTALL_DOCREADMEDIR_RPM unset - installed directly by RPM)
+SET(INSTALL_INFODIR_RPM "share/info")
+SET(INSTALL_MANDIR_RPM "share/man")
+#
+SET(INSTALL_SHAREDIR_RPM "share")
+SET(INSTALL_MYSQLSHAREDIR_RPM "share/mysql")
+SET(INSTALL_MYSQLTESTDIR_RPM "share/mysql-test")
+SET(INSTALL_SQLBENCHDIR_RPM "")
+SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql")
+#
+SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql")
+
+#
+# DEB layout
+#
+SET(INSTALL_BINDIR_DEB "bin")
+SET(INSTALL_SBINDIR_DEB "bin")
+SET(INSTALL_SCRIPTDIR_DEB "scripts")
+#
+SET(INSTALL_LIBDIR_DEB "lib")
+SET(INSTALL_PLUGINDIR_DEB "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_DEB "include")
+#
+SET(INSTALL_DOCDIR_DEB "docs")
+SET(INSTALL_DOCREADMEDIR_DEB ".")
+SET(INSTALL_MANDIR_DEB "man")
+SET(INSTALL_INFODIR_DEB "docs")
+#
+SET(INSTALL_SHAREDIR_DEB "share")
+SET(INSTALL_MYSQLSHAREDIR_DEB "share")
+SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
+SET(INSTALL_SQLBENCHDIR_DEB ".")
+SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_DEB "data")
+
+#
+# SVR4 layout
+#
+SET(INSTALL_BINDIR_SVR4 "bin")
+SET(INSTALL_SBINDIR_SVR4 "bin")
+SET(INSTALL_SCRIPTDIR_SVR4 "scripts")
+#
+SET(INSTALL_LIBDIR_SVR4 "lib")
+SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_SVR4 "include")
+#
+SET(INSTALL_DOCDIR_SVR4 "docs")
+SET(INSTALL_DOCREADMEDIR_SVR4 ".")
+SET(INSTALL_MANDIR_SVR4 "man")
+SET(INSTALL_INFODIR_SVR4 "docs")
+#
+SET(INSTALL_SHAREDIR_SVR4 "share")
+SET(INSTALL_MYSQLSHAREDIR_SVR4 "share")
+SET(INSTALL_MYSQLTESTDIR_SVR4 "mysql-test")
+SET(INSTALL_SQLBENCHDIR_SVR4 ".")
+SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql")
+
+
+# Clear cached variables if install layout was changed
+IF(OLD_INSTALL_LAYOUT)
+ IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUT)
+ SET(FORCE FORCE)
+ ENDIF()
+ENDIF()
+SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
+
+# Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR
+# will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE
+# layout is chosen)
+FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN
+ INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA)
+ SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
+ CACHE STRING "${var} installation directory" ${FORCE})
+ MARK_AS_ADVANCED(INSTALL_${var}DIR)
+ENDFOREACH()
diff --git a/win/cmake/install_macros.cmake b/win/cmake/install_macros.cmake
new file mode 100644
index 00000000000..ac59c8ecf66
--- /dev/null
+++ b/win/cmake/install_macros.cmake
@@ -0,0 +1,338 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
+MACRO (INSTALL_DEBUG_SYMBOLS targets)
+ IF(MSVC)
+ FOREACH(target ${targets})
+ GET_TARGET_PROPERTY(location ${target} LOCATION)
+ GET_TARGET_PROPERTY(type ${target} TYPE)
+ IF(NOT INSTALL_LOCATION)
+ IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY")
+ SET(INSTALL_LOCATION "lib")
+ ELSEIF(type MATCHES "EXECUTABLE")
+ SET(INSTALL_LOCATION "bin")
+ ELSE()
+ MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install")
+ ENDIF()
+ ENDIF()
+ STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
+ STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
+ STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
+ IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
+ ENDIF()
+ IF(target STREQUAL "mysqld")
+ SET(comp Server)
+ ELSEIF(pdb_location MATCHES "mysql-test")
+ SET(comp Tests)
+ ELSE()
+ SET(comp Debuginfo)
+ ENDIF()
+ INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
+ ENDFOREACH()
+ ENDIF()
+ENDMACRO()
+
+# Installs manpage for given file (either script or executable)
+#
+FUNCTION(INSTALL_MANPAGE file)
+ IF(NOT UNIX)
+ RETURN()
+ ENDIF()
+ GET_FILENAME_COMPONENT(file_name "${file}" NAME)
+ SET(GLOB_EXPR
+ ${CMAKE_SOURCE_DIR}/man/*${file}man.1*
+ ${CMAKE_SOURCE_DIR}/man/*${file}man.8*
+ ${CMAKE_BINARY_DIR}/man/*${file}man.1*
+ ${CMAKE_BINARY_DIR}/man/*${file}man.8*
+ )
+ IF(MYSQL_DOC_DIR)
+ SET(GLOB_EXPR
+ ${MYSQL_DOC_DIR}/man/*${file}man.1*
+ ${MYSQL_DOC_DIR}/man/*${file}man.8*
+ ${MYSQL_DOC_DIR}/man/*${file}.1*
+ ${MYSQL_DOC_DIR}/man/*${file}.8*
+ ${GLOB_EXPR}
+ )
+ ENDIF()
+
+ FILE(GLOB_RECURSE MANPAGES ${GLOB_EXPR})
+ IF(MANPAGES)
+ LIST(GET MANPAGES 0 MANPAGE)
+ STRING(REPLACE "${file}man.1" "${file}.1" MANPAGE "${MANPAGE}")
+ STRING(REPLACE "${file}man.8" "${file}.8" MANPAGE "${MANPAGE}")
+ IF(MANPAGE MATCHES "${file}.1")
+ SET(SECTION man1)
+ ELSE()
+ SET(SECTION man8)
+ ENDIF()
+ INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}"
+ COMPONENT ManPages)
+ ENDIF()
+ENDFUNCTION()
+
+FUNCTION(INSTALL_SCRIPT)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+
+ SET(script ${ARG_DEFAULT_ARGS})
+ IF(NOT ARG_DESTINATION)
+ SET(ARG_DESTINATION ${INSTALL_BINDIR})
+ ENDIF()
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ELSE()
+ SET(COMP)
+ ENDIF()
+
+ INSTALL(FILES
+ ${script}
+ DESTINATION ${ARG_DESTINATION}
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE ${COMP}
+ )
+ INSTALL_MANPAGE(${script})
+ENDFUNCTION()
+
+# Install symbolic link to CMake target.
+# the link is created in the same directory as target
+# and extension will be the same as for target file.
+MACRO(INSTALL_SYMLINK linkname target destination component)
+IF(UNIX)
+ GET_TARGET_PROPERTY(location ${target} LOCATION)
+ GET_FILENAME_COMPONENT(path ${location} PATH)
+ GET_FILENAME_COMPONENT(name ${location} NAME)
+ SET(output ${path}/${linkname})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${output}
+ COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
+ COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
+ ${name}
+ ${linkname}
+ WORKING_DIRECTORY ${path}
+ DEPENDS ${target}
+ )
+
+ ADD_CUSTOM_TARGET(symlink_${linkname}
+ ALL
+ DEPENDS ${output})
+ SET_TARGET_PROPERTIES(symlink_${linkname} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+ IF(CMAKE_GENERATOR MATCHES "Xcode")
+ # For Xcode, replace project config with install config
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}"
+ "\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
+ ENDIF()
+ INSTALL(FILES ${output} DESTINATION ${destination} COMPONENT ${component})
+ENDIF()
+ENDMACRO()
+
+IF(WIN32)
+ OPTION(SIGNCODE "Sign executables and dlls with digital certificate" OFF)
+ MARK_AS_ADVANCED(SIGNCODE)
+ IF(SIGNCODE)
+ SET(SIGNTOOL_PARAMETERS
+ /a /t http://timestamp.verisign.com/scripts/timstamp.dll
+ CACHE STRING "parameters for signtool (list)")
+ FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool)
+ IF(NOT SIGNTOOL_EXECUTABLE)
+ MESSAGE(FATAL_ERROR
+ "signtool is not found. Signing executables not possible")
+ ENDIF()
+ IF(NOT DEFINED SIGNCODE_ENABLED)
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testsign.c "int main(){return 0;}")
+ MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/testsign)
+ TRY_COMPILE(RESULT ${CMAKE_CURRENT_BINARY_DIR}/testsign ${CMAKE_CURRENT_BINARY_DIR}/testsign.c
+ COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
+ )
+
+ EXECUTE_PROCESS(COMMAND
+ ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
+ RESULT_VARIABLE ERR ERROR_QUIET OUTPUT_QUIET
+ )
+ IF(ERR EQUAL 0)
+ SET(SIGNCODE_ENABLED 1 CACHE INTERNAL "Can sign executables")
+ ELSE()
+ MESSAGE(STATUS "Disable authenticode signing for executables")
+ SET(SIGNCODE_ENABLED 0 CACHE INTERNAL "Invalid or missing certificate")
+ ENDIF()
+ ENDIF()
+ MARK_AS_ADVANCED(SIGNTOOL_EXECUTABLE SIGNTOOL_PARAMETERS)
+ ENDIF()
+ENDIF()
+
+MACRO(SIGN_TARGET)
+ MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
+ SET(target ${ARG_DEFAULT_ARGS})
+ IF(ARG_COMPONENT)
+ SET(comp COMPONENT ${ARG_COMPONENT})
+ ELSE()
+ SET(comp)
+ ENDIF()
+ GET_TARGET_PROPERTY(target_type ${target} TYPE)
+ IF(target_type AND NOT target_type MATCHES "STATIC")
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
+ target_location ${target_location})
+ ENDIF()
+ INSTALL(CODE
+ "EXECUTE_PROCESS(COMMAND
+ \"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\"
+ RESULT_VARIABLE ERR)
+ IF(NOT \${ERR} EQUAL 0)
+ MESSAGE(FATAL_ERROR \"Error signing ${target_location}\")
+ ENDIF()
+ " ${comp})
+ ENDIF()
+ENDMACRO()
+
+
+# Installs targets, also installs pdbs on Windows.
+#
+#
+
+FUNCTION(MYSQL_INSTALL_TARGETS)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ENDIF()
+
+ SET(TARGETS ${ARG_DEFAULT_ARGS})
+ IF(NOT TARGETS)
+ MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS")
+ ENDIF()
+ IF(NOT ARG_DESTINATION)
+ MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS")
+ ENDIF()
+
+ FOREACH(target ${TARGETS})
+ # If signing is required, sign executables before installing
+ IF(SIGNCODE AND SIGNCODE_ENABLED)
+ SIGN_TARGET(${target} ${COMP})
+ ENDIF()
+ # Install man pages on Unix
+ IF(UNIX)
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ INSTALL_MANPAGE(${target_location})
+ ENDIF()
+ ENDFOREACH()
+
+ INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP})
+ SET(INSTALL_LOCATION ${ARG_DESTINATION} )
+ INSTALL_DEBUG_SYMBOLS("${TARGETS}")
+ SET(INSTALL_LOCATION)
+ENDFUNCTION()
+
+# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir
+# (unless multi-config generator is used like Visual Studio or Xcode).
+# For Makefile generators we default Debug build directory to ${buildroot}/../debug.
+GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH)
+SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build")
+
+
+FUNCTION(INSTALL_DEBUG_TARGET target)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+ GET_TARGET_PROPERTY(target_type ${target} TYPE)
+ IF(ARG_RENAME)
+ SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
+ ELSE()
+ SET(RENAME_PARAM)
+ ENDIF()
+ IF(NOT ARG_DESTINATION)
+ MESSAGE(FATAL_ERROR "Need DESTINATION parameter for INSTALL_DEBUG_TARGET")
+ ENDIF()
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ IF(CMAKE_GENERATOR MATCHES "Makefiles")
+ STRING(REPLACE "${CMAKE_BINARY_DIR}" "${DEBUGBUILDDIR}" debug_target_location "${target_location}")
+ ELSE()
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" )
+ ENDIF()
+ IF(NOT ARG_COMPONENT)
+ SET(ARG_COMPONENT DebugBinaries)
+ ENDIF()
+
+ # Define permissions
+ # For executable files
+ SET(PERMISSIONS_EXECUTABLE
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE)
+
+ # Permissions for shared library (honors CMAKE_INSTALL_NO_EXE which is
+ # typically set on Debian)
+ IF(CMAKE_INSTALL_SO_NO_EXE)
+ SET(PERMISSIONS_SHARED_LIBRARY
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ)
+ ELSE()
+ SET(PERMISSIONS_SHARED_LIBRARY ${PERMISSIONS_EXECUTABLE})
+ ENDIF()
+
+ # Shared modules get the same permissions as shared libraries
+ SET(PERMISSIONS_MODULE_LIBRARY ${PERMISSIONS_SHARED_LIBRARY})
+
+ # Define permissions for static library
+ SET(PERMISSIONS_STATIC_LIBRARY
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ)
+
+ INSTALL(FILES ${debug_target_location}
+ DESTINATION ${ARG_DESTINATION}
+ ${RENAME_PARAM}
+ ${PERMISSIONS_${target_type}}
+ CONFIGURATIONS Release RelWithDebInfo
+ COMPONENT ${ARG_COMPONENT}
+ OPTIONAL)
+
+ IF(MSVC)
+ GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
+ STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" )
+ IF (RENAME_PARAM)
+ IF(NOT ARG_PDB_DESTINATION)
+ STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
+ SET(PDB_RENAME_PARAM RENAME "${pdb_rename}")
+ ENDIF()
+ ENDIF()
+ IF(NOT ARG_PDB_DESTINATION)
+ SET(ARG_PDB_DESTINATION "${ARG_DESTINATION}")
+ ENDIF()
+ INSTALL(FILES ${debug_pdb_target_location}
+ DESTINATION ${ARG_PDB_DESTINATION}
+ ${PDB_RENAME_PARAM}
+ CONFIGURATIONS Release RelWithDebInfo
+ COMPONENT ${ARG_COMPONENT}
+ OPTIONAL)
+ ENDIF()
+ENDFUNCTION()
+
diff --git a/win/cmake/mysql_add_executable.cmake b/win/cmake/mysql_add_executable.cmake
new file mode 100644
index 00000000000..ac812fbcdfd
--- /dev/null
+++ b/win/cmake/mysql_add_executable.cmake
@@ -0,0 +1,56 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Add executable plus some additional MySQL specific stuff
+# Usage (same as for standard CMake's ADD_EXECUTABLE)
+#
+# MYSQL_ADD_EXECUTABLE(target source1...sourceN)
+#
+# MySQL specifics:
+# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory
+# On Windows :
+# - add version resource
+# - instruct CPack to do autenticode signing if SIGNCODE is set
+
+INCLUDE(cmake_parse_arguments)
+
+FUNCTION (MYSQL_ADD_EXECUTABLE)
+ # Pass-through arguments for ADD_EXECUTABLE
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+ LIST(GET ARG_DEFAULT_ARGS 0 target)
+ LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
+
+ SET(sources ${ARG_DEFAULT_ARGS})
+ ADD_VERSION_INFO(${target} EXECUTABLE sources)
+ ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
+ # tell CPack where to install
+ IF(NOT ARG_EXCLUDE_FROM_ALL)
+ IF(NOT ARG_DESTINATION)
+ SET(ARG_DESTINATION ${INSTALL_BINDIR})
+ ENDIF()
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ELSEIF(MYSQL_INSTALL_COMPONENT)
+ SET(COMP COMPONENT ${MYSQL_INSTALL_COMPONENT})
+ ELSE()
+ SET(COMP COMPONENT Client)
+ ENDIF()
+ MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP})
+ ENDIF()
+ENDFUNCTION()
diff --git a/win/cmake/mysql_version.cmake b/win/cmake/mysql_version.cmake
new file mode 100644
index 00000000000..728ee409257
--- /dev/null
+++ b/win/cmake/mysql_version.cmake
@@ -0,0 +1,140 @@
+
+MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
+ IF(NOT ${var})
+ IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
+ FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=")
+ IF(str)
+ STRING(REPLACE "${keyword}=" "" str ${str})
+ STRING(REGEX REPLACE "[ ].*" "" str ${str})
+ SET(${var} ${str} CACHE INTERNAL "Config variable")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ENDMACRO()
+
+
+# Read mysql version for configure script
+
+MACRO(GET_MYSQL_VERSION)
+
+ IF(NOT VERSION_STRING)
+ IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
+ FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE")
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}")
+ IF(NOT VERSION_STRING)
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
+ IF(NOT VERSION_STRING)
+ FILE(STRINGS configure.in str REGEX "AC_INIT\\(")
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zA-Z0-9]+" VERSION_STRING "${str}")
+ IF(NOT VERSION_STRING)
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ IF(NOT VERSION_STRING)
+ MESSAGE(FATAL_ERROR
+ "VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra"
+ "when calling cmake")
+ ENDIF()
+
+ SET(VERSION ${VERSION_STRING})
+ STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}")
+
+ # Remove trailing (non-numeric) part of the version string
+ STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING})
+
+ STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
+ STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
+ STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}")
+ SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
+ SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}")
+ MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}")
+ MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
+ SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
+ SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
+ SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH})
+ENDMACRO()
+
+# Get mysql version and other interesting variables
+GET_MYSQL_VERSION()
+
+MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION)
+MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION)
+MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT)
+MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT)
+MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION)
+IF(NOT MYSQL_TCP_PORT_DEFAULT)
+ SET(MYSQL_TCP_PORT_DEFAULT "3306")
+ENDIF()
+IF(NOT MYSQL_TCP_PORT)
+ SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
+ SET(MYSQL_TCP_PORT_DEFAULT "0")
+ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
+ SET(MYSQL_TCP_PORT_DEFAULT "0")
+ENDIF()
+
+
+IF(NOT MYSQL_UNIX_ADDR)
+ SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
+ENDIF()
+IF(NOT COMPILATION_COMMENT)
+ SET(COMPILATION_COMMENT "Source distribution")
+ENDIF()
+
+
+INCLUDE(package_name)
+IF(NOT CPACK_PACKAGE_FILE_NAME)
+ GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME)
+ENDIF()
+
+IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME)
+ SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}")
+ENDIF()
+SET(CPACK_PACKAGE_CONTACT "MariaDB team <build@mysql.com>")
+SET(CPACK_PACKAGE_VENDOR "Monty Program AB")
+SET(CPACK_SOURCE_GENERATOR "TGZ")
+INCLUDE(cpack_source_ignore_files)
+
+# Defintions for windows version resources
+SET(PRODUCTNAME "MariaDB Server")
+SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR})
+
+# Windows 'date' command has unpredictable output, so cannot rely on it to
+# set MYSQL_COPYRIGHT_YEAR - if someone finds a portable way to do so then
+# it might be useful
+#IF (WIN32)
+# EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE TMP_DATE)
+# STRING(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" MYSQL_COPYRIGHT_YEAR ${TMP_DATE})
+IF(UNIX)
+ EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE MYSQL_COPYRIGHT_YEAR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF()
+
+# Add version information to the exe and dll files
+# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
+# for more info.
+IF(MSVC)
+ GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+ SET(FILETYPE VFT_APP)
+ CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
+ ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
+
+ SET(FILETYPE VFT_DLL)
+ CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
+ ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
+
+ FUNCTION(ADD_VERSION_INFO target target_type sources_var)
+ IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE")
+ SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
+ ELSEIF("${target_type}" MATCHES "EXE")
+ SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
+ ENDIF()
+ SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE)
+ ENDFUNCTION()
+ELSE()
+ FUNCTION(ADD_VERSION_INFO)
+ ENDFUNCTION()
+ENDIF()
diff --git a/win/cmake/package_name.cmake b/win/cmake/package_name.cmake
new file mode 100644
index 00000000000..1bbe68a0336
--- /dev/null
+++ b/win/cmake/package_name.cmake
@@ -0,0 +1,134 @@
+# Copyright (C) 2010 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Produce meaningful package name for the binary package
+# The logic is rather involved with special cases for different OSes
+INCLUDE(CheckTypeSize)
+CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
+MACRO(GET_PACKAGE_FILE_NAME Var)
+IF(NOT VERSION)
+ MESSAGE(FATAL_ERROR
+ "Variable VERSION needs to be set prior to calling GET_PACKAGE_FILE_NAME")
+ ENDIF()
+ IF(NOT SYSTEM_NAME_AND_PROCESSOR)
+ SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1)
+ SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME})
+ SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
+ IF(SIZEOF_VOIDP EQUAL 8)
+ SET(64BIT 1)
+ ENDIF()
+
+ IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+ SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
+ SET(DEFAULT_PLATFORM "win")
+ IF(64BIT)
+ SET(DEFAULT_MACHINE "x64")
+ ELSE()
+ SET(DEFAULT_MACHINE "32")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ SET(DEFAULT_MACHINE "i686")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ # SunOS 5.10=> solaris10
+ STRING(REPLACE "5." "" VER "${CMAKE_SYSTEM_VERSION}")
+ SET(DEFAULT_PLATFORM "solaris${VER}")
+ IF(64BIT)
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
+ SET(DEFAULT_MACHINE "x86_64")
+ ELSE()
+ SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
+ ENDIF()
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+ STRING(REPLACE "B." "" VER "${CMAKE_SYSTEM_VERSION}")
+ SET(DEFAULT_PLATFORM "hpux${VER}")
+ IF(64BIT)
+ SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
+ SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}5.${CMAKE_SYSTEM_VERSION}")
+ IF(64BIT)
+ SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+" VER "${CMAKE_SYSTEM_VERSION}")
+ SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}${VER}")
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
+ SET(DEFAULT_MACHINE "x86_64")
+ IF(NOT 64BIT)
+ SET(DEFAULT_MACHINE "i386")
+ ENDIF()
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ IF(CMAKE_OSX_DEPLOYMENT_TARGET)
+ SET(DEFAULT_PLATFORM "osx${CMAKE_OSX_DEPLOYMENT_TARGET}")
+ ELSE()
+ SET(VER "${CMAKE_SYSTEM_VERSION}")
+ STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VER "${VER}")
+ # Subtract 4 from Darwin version to get correct osx10.X
+ MATH(EXPR VER "${VER} -4")
+ SET(DEFAULT_PLATFORM "osx10.${VER}")
+ ENDIF()
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN)
+ IF(LEN GREATER 1)
+ SET(DEFAULT_MACHINE "universal")
+ ELSE()
+ SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
+ IF(NOT DEFAULT_MACHINE)
+ IF(CMAKE_SIZEOF_VOIPD EQUAL 4)
+ SET(DEFAULT_MACHINE "i386")
+ ELSE()
+ SET(DEFAULT_MACHINE "x86_64")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ IF(DEFAULT_MACHINE MATCHES "i386")
+ SET(DEFAULT_MACHINE "x86")
+ ENDIF()
+ ENDIF()
+
+ IF(NOT PLATFORM)
+ SET(PLATFORM ${DEFAULT_PLATFORM})
+ ENDIF()
+ IF(NOT MACHINE)
+ SET(MACHINE ${DEFAULT_MACHINE})
+ ENDIF()
+
+ IF(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE)
+ SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}-${MACHINE}")
+ ELSE()
+ SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}${MACHINE}")
+ ENDIF()
+ ENDIF()
+
+ IF(SHORT_PRODUCT_TAG)
+ SET(PRODUCT_TAG "-${SHORT_PRODUCT_TAG}")
+ ELSEIF(MYSQL_SERVER_SUFFIX)
+ SET(PRODUCT_TAG "${MYSQL_SERVER_SUFFIX}") # Already has a leading dash
+ ELSE()
+ SET(PRODUCT_TAG)
+ ENDIF()
+
+ SET(package_name "mariadb${PRODUCT_TAG}-${MYSQL_NO_DASH_VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
+
+ # Sometimes package suffix is added (something like "-icc-glibc23")
+ IF(PACKAGE_SUFFIX)
+ SET(package_name "${package_name}${PACKAGE_SUFFIX}")
+ ENDIF()
+ STRING(TOLOWER ${package_name} package_name)
+ SET(${Var} ${package_name})
+ENDMACRO()
diff --git a/win/cmake/versioninfo.rc.in b/win/cmake/versioninfo.rc.in
new file mode 100644
index 00000000000..97c45ec86c0
--- /dev/null
+++ b/win/cmake/versioninfo.rc.in
@@ -0,0 +1,23 @@
+#include <windows.h>
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
+PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS 0
+FILEOS VOS__WINDOWS32
+FILETYPE @FILETYPE@
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
+ VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
diff --git a/win/make_mariadb_win_dist b/win/make_mariadb_win_dist
index a7ca8f2c9df..f6d961ea866 100644
--- a/win/make_mariadb_win_dist
+++ b/win/make_mariadb_win_dist
@@ -19,6 +19,13 @@ The default is to the builds and create 32 bit packages.
EOF
}
+
+if test -f win/build_maria_release.bat
+then
+ cmd /c win\\build_maria_release.bat "$@"
+ exit $?
+fi
+
# The default settings
CMAKE_GENERATOR="Visual Studio 9 2008"
ARCH="win32"
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
index a4b75bd5744..43235b631f6 100755
--- a/zlib/CMakeLists.txt
+++ b/zlib/CMakeLists.txt
@@ -27,6 +27,4 @@ SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.
zutil.c zutil.h)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(zlib ${ZLIB_SOURCES})
-
- INSTALL(TARGETS zlib DESTINATION lib/opt COMPONENT runtime) # TODO: Component
ENDIF(NOT SOURCE_SUBLIBS)