summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCMakeLists.txt132
-rwxr-xr-xbdb/CMakeLists.txt44
-rwxr-xr-xclient/CMakeLists.txt79
-rwxr-xr-xdbug/CMakeLists.txt5
-rwxr-xr-xextra/CMakeLists.txt32
-rwxr-xr-xextra/yassl/CMakeLists.txt6
-rwxr-xr-xextra/yassl/taocrypt/CMakeLists.txt10
-rwxr-xr-xheap/CMakeLists.txt8
-rwxr-xr-xinnobase/CMakeLists.txt35
-rwxr-xr-xlibmysql/CMakeLists.txt54
-rwxr-xr-xmyisam/CMakeLists.txt26
-rwxr-xr-xmyisammrg/CMakeLists.txt9
-rwxr-xr-xmysys/CMakeLists.txt29
-rwxr-xr-xregex/CMakeLists.txt5
-rwxr-xr-xserver-tools/CMakeLists.txt18
-rwxr-xr-xserver-tools/instance-manager/CMakeLists.txt17
-rwxr-xr-xsql/CMakeLists.txt114
-rwxr-xr-xsql/examples/CMakeLists.txt11
-rwxr-xr-xstrings/CMakeLists.txt12
-rwxr-xr-xtests/CMakeLists.txt9
-rwxr-xr-xvio/CMakeLists.txt6
-rwxr-xr-xwin/Makefile.am21
-rw-r--r--win/README82
-rwxr-xr-xwin/build-vs71.bat7
-rwxr-xr-xwin/build-vs8.bat6
-rwxr-xr-xwin/build-vs8_x64.bat6
-rwxr-xr-xwin/configure.js166
-rwxr-xr-xzlib/CMakeLists.txt8
28 files changed, 957 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 00000000000..fd780ec6a13
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,132 @@
+PROJECT(MySql)
+
+# This reads user configuration, generated by configure.js.
+INCLUDE(win/configure.data)
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
+ ${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
+
+# Set standard options
+ADD_DEFINITIONS(-D WITH_MYISAM_STORAGE_ENGINE)
+ADD_DEFINITIONS(-D CMAKE_BUILD)
+ADD_DEFINITIONS(-D HAVE_YASSL)
+
+SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisam_plugin")
+
+
+IF(WITH_ARCHIVE_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D HAVE_ARCHIVE_DB)
+ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
+
+IF (WITH_HEAP_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D WITH_HEAP_STORAGE_ENGINE)
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin")
+ENDIF (WITH_HEAP_STORAGE_ENGINE)
+
+IF (WITH_MYISAMMRG_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D WITH_MYISAMMRG_STORAGE_ENGINE)
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin")
+ENDIF (WITH_MYISAMMRG_STORAGE_ENGINE)
+
+IF(WITH_INNOBASE_STORAGE_ENGINE)
+ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/innobase/ib_config.h.in
+ ${CMAKE_SOURCE_DIR}/innobase/ib_config.h @ONLY)
+ ADD_DEFINITIONS(-D HAVE_INNOBASE_DB)
+ ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE)
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin")
+ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+
+IF(WITH_FEDERATED_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D HAVE_FEDERATED_DB)
+ ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE)
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
+ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
+
+IF(WITH_BERKELEY_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D HAVE_BERKELEY_DB)
+ ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE)
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin")
+ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
+
+IF (WITH_BLACKHOLE_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-D HAVE_BLACKHOLE_DB)
+ENDIF (WITH_BLACKHOLE_STORAGE_ENGINE)
+
+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)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.cnf.sh
+ ${CMAKE_SOURCE_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)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
+ ${CMAKE_SOURCE_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)
+
+IF(__NT__)
+ ADD_DEFINITIONS(-D __NT__)
+ENDIF(__NT__)
+IF(CYBOZU)
+ ADD_DEFINITIONS(-D CYBOZU)
+ENDIF(CYBOZU)
+
+# in some places we use DBUG_OFF
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF")
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
+ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
+ CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ # replace /MDd with /MTd
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT
+ ${CMAKE_CXX_FLAGS_DEBUG_INIT})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT
+ ${CMAKE_C_FLAGS_DEBUG_INIT})
+ STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE
+ ${CMAKE_C_FLAGS_RELEASE})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG
+ ${CMAKE_C_FLAGS_DEBUG})
+ STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE
+ ${CMAKE_CXX_FLAGS_RELEASE})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG
+ ${CMAKE_CXX_FLAGS_DEBUG})
+
+ # remove support for Exception handling
+ STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+ STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+ STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT
+ ${CMAKE_CXX_FLAGS_INIT})
+ STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT
+ ${CMAKE_CXX_FLAGS_DEBUG_INIT})
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
+ CMAKE_GENERATOR MATCHES "Visual Studio 8")
+
+ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE")
+
+ADD_SUBDIRECTORY(vio)
+ADD_SUBDIRECTORY(dbug)
+ADD_SUBDIRECTORY(strings)
+ADD_SUBDIRECTORY(regex)
+ADD_SUBDIRECTORY(mysys)
+ADD_SUBDIRECTORY(extra/yassl)
+ADD_SUBDIRECTORY(extra/yassl/taocrypt)
+ADD_SUBDIRECTORY(extra)
+ADD_SUBDIRECTORY(zlib)
+ADD_SUBDIRECTORY(heap)
+ADD_SUBDIRECTORY(myisam)
+ADD_SUBDIRECTORY(myisammrg)
+ADD_SUBDIRECTORY(client)
+ADD_SUBDIRECTORY(bdb)
+ADD_SUBDIRECTORY(innobase)
+ADD_SUBDIRECTORY(sql)
+ADD_SUBDIRECTORY(sql/examples)
+ADD_SUBDIRECTORY(server-tools/instance-manager)
+ADD_SUBDIRECTORY(libmysql)
+ADD_SUBDIRECTORY(tests)
diff --git a/bdb/CMakeLists.txt b/bdb/CMakeLists.txt
new file mode 100755
index 00000000000..c5dd60852d4
--- /dev/null
+++ b/bdb/CMakeLists.txt
@@ -0,0 +1,44 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bdb/build_win32
+ ${CMAKE_SOURCE_DIR}/bdb/dbinc
+ ${CMAKE_SOURCE_DIR}/bdb)
+
+# BDB needs a number of source files that are auto-generated by the unix
+# configure. So to build BDB, it is necessary to copy these over to the Windows
+# bitkeeper tree, or to use a source .tar.gz package which already has these
+# files.
+ADD_LIBRARY(bdb btree/bt_compare.c btree/bt_conv.c btree/bt_curadj.c btree/bt_cursor.c
+ btree/bt_delete.c btree/bt_method.c btree/bt_open.c btree/bt_put.c btree/bt_rec.c
+ btree/bt_reclaim.c btree/bt_recno.c btree/bt_rsearch.c btree/bt_search.c
+ btree/bt_split.c btree/bt_stat.c btree/bt_upgrade.c btree/bt_verify.c btree/btree_auto.c
+ db/crdel_auto.c db/crdel_rec.c db/db.c db/db_am.c db/db_auto.c common/db_byteorder.c
+ db/db_cam.c db/db_conv.c db/db_dispatch.c db/db_dup.c common/db_err.c common/db_getlong.c
+ common/db_idspace.c db/db_iface.c db/db_join.c common/db_log2.c db/db_meta.c
+ db/db_method.c db/db_open.c db/db_overflow.c db/db_pr.c db/db_rec.c db/db_reclaim.c
+ db/db_remove.c db/db_rename.c db/db_ret.c env/db_salloc.c env/db_shash.c db/db_truncate.c
+ db/db_upg.c db/db_upg_opd.c db/db_vrfy.c db/db_vrfyutil.c dbm/dbm.c dbreg/dbreg.c
+ dbreg/dbreg_auto.c dbreg/dbreg_rec.c dbreg/dbreg_util.c env/env_file.c env/env_method.c
+ env/env_open.c env/env_recover.c env/env_region.c fileops/fileops_auto.c fileops/fop_basic.c
+ fileops/fop_rec.c fileops/fop_util.c hash/hash.c hash/hash_auto.c hash/hash_conv.c
+ hash/hash_dup.c hash/hash_func.c hash/hash_meta.c hash/hash_method.c hash/hash_open.c
+ hash/hash_page.c hash/hash_rec.c hash/hash_reclaim.c hash/hash_stat.c hash/hash_upgrade.c
+ hash/hash_verify.c hmac/hmac.c hsearch/hsearch.c lock/lock.c lock/lock_deadlock.c
+ lock/lock_method.c lock/lock_region.c lock/lock_stat.c lock/lock_util.c log/log.c
+ log/log_archive.c log/log_compare.c log/log_get.c log/log_method.c log/log_put.c
+ mp/mp_alloc.c mp/mp_bh.c mp/mp_fget.c mp/mp_fopen.c mp/mp_fput.c
+ mp/mp_fset.c mp/mp_method.c mp/mp_region.c mp/mp_register.c mp/mp_stat.c mp/mp_sync.c
+ mp/mp_trickle.c mutex/mut_tas.c mutex/mut_win32.c mutex/mutex.c os_win32/os_abs.c
+ os/os_alloc.c os_win32/os_clock.c os_win32/os_config.c os_win32/os_dir.c os_win32/os_errno.c
+ os_win32/os_fid.c os_win32/os_fsync.c os_win32/os_handle.c os/os_id.c os_win32/os_map.c
+ os/os_method.c os/os_oflags.c os_win32/os_open.c os/os_region.c os_win32/os_rename.c
+ os/os_root.c os/os_rpath.c os_win32/os_rw.c os_win32/os_seek.c os_win32/os_sleep.c
+ os_win32/os_spin.c os_win32/os_stat.c os/os_tmpdir.c os_win32/os_type.c os/os_unlink.c
+ qam/qam.c qam/qam_auto.c qam/qam_conv.c qam/qam_files.c qam/qam_method.c qam/qam_open.c
+ qam/qam_rec.c qam/qam_stat.c qam/qam_upgrade.c qam/qam_verify.c rep/rep_method.c
+ rep/rep_record.c rep/rep_region.c rep/rep_util.c hmac/sha1.c
+ clib/strcasecmp.c txn/txn.c txn/txn_auto.c txn/txn_method.c txn/txn_rec.c
+ txn/txn_recover.c txn/txn_region.c txn/txn_stat.c txn/txn_util.c common/util_log.c
+ common/util_sig.c xa/xa.c xa/xa_db.c xa/xa_map.c)
+
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
new file mode 100755
index 00000000000..3e7f1a48c70
--- /dev/null
+++ b/client/CMakeLists.txt
@@ -0,0 +1,79 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+# The old Windows build method used renamed (.cc -> .cpp) source files, fails
+# in #include in mysqlbinlog.cc. So disable that using the USING_CMAKE define.
+ADD_DEFINITIONS(-DUSING_CMAKE)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/zlib
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/libmysql
+ ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/mysys
+ ${CMAKE_SOURCE_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/strings)
+
+ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
+ ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
+ ../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
+ ../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
+ ../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
+ ../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
+ ../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
+ ../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
+ ../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
+ ../mysys/default.c ../libmysql/errmsg.c ../mysys/errors.c
+ ../libmysql/get_password.c ../strings/int2str.c ../strings/is_prefix.c
+ ../libmysql/libmysql.c ../mysys/list.c ../strings/llstr.c
+ ../strings/longlong2str.c ../libmysql/manager.c ../mysys/mf_cache.c
+ ../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
+ ../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
+ ../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
+ ../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
+ ../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
+ ../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
+ ../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
+ ../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
+ ../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
+ ../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
+ ../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
+ ../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
+ ../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
+ ../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
+ ../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
+ ../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
+ ../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
+ ../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
+ ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
+ ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
+ ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
+ ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
+
+ADD_DEPENDENCIES(mysqlclient GenError)
+ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
+LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
+TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl taocrypt zlib dbug wsock32)
+
+ADD_EXECUTABLE(mysqltest mysqltest.c)
+TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys yassl taocrypt zlib dbug regex wsock32)
+
+ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
+TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug yassl taocrypt zlib wsock32)
+
+ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
+TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug yassl taocrypt zlib wsock32)
+
+ADD_EXECUTABLE(mysqlimport mysqlimport.c)
+TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl taocrypt zlib wsock32)
+
+ADD_EXECUTABLE(mysqlshow mysqlshow.c)
+TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl taocrypt zlib wsock32)
+
+ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc
+ ../mysys/my_bit.c ../mysys/my_bitmap.c
+ ../mysys/base64.c)
+TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug yassl taocrypt zlib wsock32)
+
+ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
+TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32)
+
diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt
new file mode 100755
index 00000000000..fe20fdd3db6
--- /dev/null
+++ b/dbug/CMakeLists.txt
@@ -0,0 +1,5 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -D__WIN32__")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ADD_LIBRARY(dbug dbug.c factorial.c sanity.c)
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
new file mode 100755
index 00000000000..50e0f04eb14
--- /dev/null
+++ b/extra/CMakeLists.txt
@@ -0,0 +1,32 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+ADD_EXECUTABLE(comp_err comp_err.c)
+TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32)
+
+GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
+
+ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_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
+ --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)
+
+ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
+TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt odbc32 odbccp32 wsock32)
+
+ADD_EXECUTABLE(perror perror.c)
+TARGET_LINK_LIBRARIES(perror strings mysys dbug wsock32)
+
+ADD_EXECUTABLE(replace replace.c)
+TARGET_LINK_LIBRARIES(replace strings mysys dbug wsock32)
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
new file mode 100755
index 00000000000..e5429876072
--- /dev/null
+++ b/extra/yassl/CMakeLists.txt
@@ -0,0 +1,6 @@
+ADD_DEFINITIONS("-DWIN32 -D_LIB -DYASSL_PREFIX")
+
+INCLUDE_DIRECTORIES(include taocrypt/include mySTL)
+ADD_LIBRARY(yassl src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
+ src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
+ src/yassl_imp.cpp src/yassl_int.cpp)
diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt
new file mode 100755
index 00000000000..0af0a242e5d
--- /dev/null
+++ b/extra/yassl/taocrypt/CMakeLists.txt
@@ -0,0 +1,10 @@
+INCLUDE_DIRECTORIES(../mySTL include)
+
+ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
+ src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
+ src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
+ include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp
+ include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp
+ include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
+ include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
+ include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp)
diff --git a/heap/CMakeLists.txt b/heap/CMakeLists.txt
new file mode 100755
index 00000000000..db5fb8b2981
--- /dev/null
+++ b/heap/CMakeLists.txt
@@ -0,0 +1,8 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ADD_LIBRARY(heap _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create.c
+ hp_delete.c hp_extra.c hp_hash.c hp_info.c hp_open.c hp_panic.c
+ hp_rename.c hp_rfirst.c hp_rkey.c hp_rlast.c hp_rnext.c hp_rprev.c
+ hp_rrnd.c hp_rsame.c hp_scan.c hp_static.c hp_update.c hp_write.c)
diff --git a/innobase/CMakeLists.txt b/innobase/CMakeLists.txt
new file mode 100755
index 00000000000..f9661963d56
--- /dev/null
+++ b/innobase/CMakeLists.txt
@@ -0,0 +1,35 @@
+#SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
+#SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
+ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include include)
+ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
+ buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
+ data/data0data.c data/data0type.c
+ dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c
+ dyn/dyn0dyn.c
+ eval/eval0eval.c eval/eval0proc.c
+ fil/fil0fil.c
+ fsp/fsp0fsp.c
+ fut/fut0fut.c fut/fut0lst.c
+ ha/ha0ha.c ha/hash0hash.c
+ ibuf/ibuf0ibuf.c
+ pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c
+ lock/lock0lock.c
+ log/log0log.c log/log0recv.c
+ mach/mach0data.c
+ mem/mem0mem.c mem/mem0pool.c
+ mtr/mtr0log.c mtr/mtr0mtr.c
+ os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
+ page/page0cur.c page/page0page.c
+ que/que0que.c
+ read/read0read.c
+ rem/rem0cmp.c rem/rem0rec.c
+ row/row0ins.c row/row0mysql.c row/row0purge.c row/row0row.c row/row0sel.c row/row0uins.c
+ row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c
+ srv/srv0que.c srv/srv0srv.c srv/srv0start.c
+ sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c
+ thr/thr0loc.c
+ trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c
+ usr/usr0sess.c
+ ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c )
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
new file mode 100755
index 00000000000..d12b6ca6c10
--- /dev/null
+++ b/libmysql/CMakeLists.txt
@@ -0,0 +1,54 @@
+# Need to set USE_TLS, since __declspec(thread) approach to thread local
+# storage does not work properly in DLLs.
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/zlib
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/libmysql
+ ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/strings)
+
+ADD_LIBRARY(libmysql SHARED dll.c libmysql.def
+ ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
+ ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
+ ../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
+ ../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
+ ../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
+ ../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
+ ../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
+ ../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
+ ../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
+ ../mysys/default.c ../libmysql/errmsg.c ../mysys/errors.c
+ ../libmysql/get_password.c ../strings/int2str.c ../strings/is_prefix.c
+ ../libmysql/libmysql.c ../mysys/list.c ../strings/llstr.c
+ ../strings/longlong2str.c ../libmysql/manager.c ../mysys/mf_cache.c
+ ../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
+ ../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
+ ../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
+ ../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
+ ../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
+ ../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
+ ../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
+ ../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
+ ../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
+ ../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
+ ../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
+ ../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
+ ../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
+ ../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
+ ../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
+ ../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
+ ../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
+ ../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
+ ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
+ ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
+ ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
+ ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
+ADD_DEPENDENCIES(libmysql dbug vio mysys strings GenError zlib yassl taocrypt)
+TARGET_LINK_LIBRARIES(libmysql mysys strings wsock32)
+
+ADD_EXECUTABLE(myTest mytest.c)
+TARGET_LINK_LIBRARIES(myTest libmysql)
diff --git a/myisam/CMakeLists.txt b/myisam/CMakeLists.txt
new file mode 100755
index 00000000000..3ba7aba4555
--- /dev/null
+++ b/myisam/CMakeLists.txt
@@ -0,0 +1,26 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c
+ ft_stopwords.c ft_update.c mi_cache.c mi_changed.c mi_check.c
+ mi_checksum.c mi_close.c mi_create.c mi_dbug.c mi_delete.c
+ mi_delete_all.c mi_delete_table.c mi_dynrec.c mi_extra.c mi_info.c
+ mi_key.c mi_keycache.c mi_locking.c mi_log.c mi_open.c
+ mi_packrec.c mi_page.c mi_panic.c mi_preload.c mi_range.c mi_rename.c
+ mi_rfirst.c mi_rlast.c mi_rnext.c mi_rnext_same.c mi_rprev.c mi_rrnd.c
+ mi_rsame.c mi_rsamepos.c mi_scan.c mi_search.c mi_static.c mi_statrec.c
+ mi_unique.c mi_update.c mi_write.c rt_index.c rt_key.c rt_mbr.c
+ rt_split.c sort.c sp_key.c ft_eval.h myisamdef.h rt_index.h mi_rkey.c)
+
+ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
+TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib wsock32)
+
+ADD_EXECUTABLE(myisamchk myisamchk.c)
+TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib wsock32)
+
+ADD_EXECUTABLE(myisamlog myisamlog.c)
+TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib wsock32)
+
+ADD_EXECUTABLE(myisampack myisampack.c)
+TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib wsock32)
diff --git a/myisammrg/CMakeLists.txt b/myisammrg/CMakeLists.txt
new file mode 100755
index 00000000000..83168f6c60c
--- /dev/null
+++ b/myisammrg/CMakeLists.txt
@@ -0,0 +1,9 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ADD_LIBRARY(myisammrg myrg_close.c myrg_create.c myrg_delete.c myrg_extra.c myrg_info.c
+ myrg_locking.c myrg_open.c myrg_panic.c myrg_queue.c myrg_range.c
+ myrg_rfirst.c myrg_rkey.c myrg_rlast.c myrg_rnext.c myrg_rnext_same.c
+ myrg_rprev.c myrg_rrnd.c myrg_rsame.c myrg_static.c myrg_update.c
+ myrg_write.c)
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
new file mode 100755
index 00000000000..7926cb916c1
--- /dev/null
+++ b/mysys/CMakeLists.txt
@@ -0,0 +1,29 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+# Need to set USE_TLS, since mysys is linked into libmysql.dll and
+# libmysqld.dll, and __declspec(thread) approach to thread local storage does
+# not work properly in DLLs.
+# Currently, USE_TLS crashes in Debug builds, so until that is fixed Debug
+# .dlls cannot be loaded at runtime.
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DUSE_TLS")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DUSE_TLS")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys )
+ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_modify.c
+ errors.c hash.c list.c md5.c mf_brkhant.c mf_cache.c mf_dirname.c mf_fn_ext.c
+ mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c
+ mf_keycaches.c mf_loadpath.c mf_pack.c mf_path.c mf_qsort.c mf_qsort2.c
+ mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_strip.c mf_tempdir.c
+ mf_tempfile.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_access.c
+ my_aes.c my_alarm.c my_alloc.c my_append.c my_bit.c my_bitmap.c my_chsize.c
+ my_clock.c my_compress.c my_conio.c my_copy.c my_crc32.c my_create.c my_delete.c
+ my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c
+ my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
+ my_lib.c my_lock.c my_lockmem.c my_lread.c my_lwrite.c my_malloc.c my_messnc.c
+ my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c
+ my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c
+ my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_wincond.c
+ my_windac.c my_winsem.c my_winthread.c my_write.c ptr_cmp.c queues.c
+ rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
+ thr_rwlock.c tree.c typelib.c base64.c my_memmem.c)
diff --git a/regex/CMakeLists.txt b/regex/CMakeLists.txt
new file mode 100755
index 00000000000..796481a62d5
--- /dev/null
+++ b/regex/CMakeLists.txt
@@ -0,0 +1,5 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys})
+ADD_LIBRARY(regex debug.c regcomp.c regerror.c regexec.c regfree.c reginit.c split.c)
diff --git a/server-tools/CMakeLists.txt b/server-tools/CMakeLists.txt
new file mode 100755
index 00000000000..1983d459ce2
--- /dev/null
+++ b/server-tools/CMakeLists.txt
@@ -0,0 +1,18 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER)
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql
+ ${PROJECT_SOURCE_DIR}/extra/yassl/include)
+
+ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc
+ instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc
+ mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc
+ thread_registry.cc user_map.cc imservice.cpp windowsservice.cpp
+ user_management_commands.cc
+ ../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c
+ ../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c
+ ../../libmysql/errmsg.c)
+
+ADD_DEPENDENCIES(mysqlmanager GenError)
+TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)
diff --git a/server-tools/instance-manager/CMakeLists.txt b/server-tools/instance-manager/CMakeLists.txt
new file mode 100755
index 00000000000..fafc3df4108
--- /dev/null
+++ b/server-tools/instance-manager/CMakeLists.txt
@@ -0,0 +1,17 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER)
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql
+ ${PROJECT_SOURCE_DIR}/extra/yassl/include)
+
+ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc
+ instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc
+ mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc
+ thread_registry.cc user_map.cc IMService.cpp WindowsService.cpp
+ ../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c
+ ../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c
+ ../../libmysql/errmsg.c)
+
+ADD_DEPENDENCIES(mysqlmanager GenError)
+TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
new file mode 100755
index 00000000000..b01871872ce
--- /dev/null
+++ b/sql/CMakeLists.txt
@@ -0,0 +1,114 @@
+SET(CMAKE_CXX_FLAGS_DEBUG
+ "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi")
+SET(CMAKE_C_FLAGS_DEBUG
+ "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /MAP /MAPINFO:EXPORTS")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/zlib
+ ${CMAKE_SOURCE_DIR}/bdb/build_win32
+ ${CMAKE_SOURCE_DIR}/bdb/dbinc)
+
+SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc
+ ${CMAKE_SOURCE_DIR}/sql/message.h
+ ${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/lex_hash.h
+ ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
+ ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
+ ${PROJECT_SOURCE_DIR}/include/sql_state.h
+ PROPERTIES GENERATED 1)
+
+ADD_DEFINITIONS(-DHAVE_INNOBASE -DMYSQL_SERVER
+ -D_CONSOLE -DHAVE_DLOPEN)
+
+ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
+ discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
+ filesort.cc gstream.cc ha_blackhole.cc
+ ha_archive.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc
+ ha_innodb.cc ha_federated.cc ha_berkeley.cc ha_blackhole.cc
+ handler.cc hash_filo.cc hash_filo.h
+ hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
+ item_create.cc item_func.cc item_geofunc.cc item_row.cc
+ item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
+ item_uniq.cc key.cc log.cc lock.cc log_event.cc message.rc
+ message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
+ ../myisammrg/myrg_rnext_same.c mysqld.cc net_serv.cc
+ nt_servc.cc nt_servc.h opt_range.cc opt_range.h opt_sum.cc
+ ../sql-common/pack.c parse_file.cc password.c procedure.cc
+ protocol.cc records.cc repl_failsafe.cc set_var.cc
+ slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
+ sp_rcontext.cc spatial.cc sql_acl.cc sql_analyse.cc sql_base.cc
+ sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
+ sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
+ sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
+ sql_list.cc sql_load.cc sql_manager.cc sql_map.cc sql_parse.cc
+ sql_prepare.cc sql_rename.cc
+ sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
+ sql_table.cc sql_test.cc sql_trigger.cc sql_udf.cc sql_union.cc
+ sql_update.cc sql_view.cc strfunc.cc table.cc thr_malloc.cc
+ time.cc tztime.cc uniques.cc unireg.cc
+ ../sql-common/my_user.c
+ sql_locale.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/lex_hash.h)
+
+TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg mysys yassl zlib dbug yassl
+ taocrypt strings vio regex wsock32)
+
+IF(WITH_EXAMPLE_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(mysqld example)
+ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
+
+IF(WITH_INNOBASE_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(mysqld innobase)
+ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+
+IF(WITH_BERKELEY_STORAGE_ENGINE)
+ TARGET_LINK_LIBRARIES(mysqld bdb)
+ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
+
+
+ADD_DEPENDENCIES(mysqld GenError)
+
+# Sql Parser custom command
+ADD_CUSTOM_COMMAND(
+ SOURCE ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
+ OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
+ COMMAND bison.exe ARGS -y -p MYSQL --defines=sql_yacc.h
+ --output=sql_yacc.cc sql_yacc.yy
+ DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy)
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
+ COMMAND echo
+ DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
+)
+
+# Windows message file
+ADD_CUSTOM_COMMAND(
+ SOURCE ${PROJECT_SOURCE_DIR}/sql/message.mc
+ OUTPUT message.rc message.h
+ COMMAND mc ARGS ${PROJECT_SOURCE_DIR}/sql/message.mc
+ DEPENDS ${PROJECT_SOURCE_DIR}/sql/message.mc)
+
+# Gen_lex_hash
+ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
+TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient wsock32)
+GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h
+ COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
+ DEPENDS ${GEN_LEX_HASH_EXE}
+)
+
+ADD_DEPENDENCIES(mysqld gen_lex_hash)
diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt
new file mode 100755
index 00000000000..d3cc430ef40
--- /dev/null
+++ b/sql/examples/CMakeLists.txt
@@ -0,0 +1,11 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/regex)
+
+IF(WITH_EXAMPLE_STORAGE_ENGINE)
+ADD_LIBRARY(example ha_example.cc)
+ADD_DEPENDENCIES(example GenError)
+ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
new file mode 100755
index 00000000000..0c65ce390b2
--- /dev/null
+++ b/strings/CMakeLists.txt
@@ -0,0 +1,12 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ADD_LIBRARY(strings bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
+ ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c
+ ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
+ ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c
+ is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c
+ str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
+ strtod.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c
+ strcont.c strinstr.c)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100755
index 00000000000..46c42d461f3
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,9 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+ADD_DEFINITIONS("-DMYSQL_CLIENT")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+ADD_EXECUTABLE(mysql_client_test mysql_client_test.c)
+TARGET_LINK_LIBRARIES(mysql_client_test dbug mysys mysqlclient yassl taocrypt zlib wsock32)
diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt
new file mode 100755
index 00000000000..a3cbb304289
--- /dev/null
+++ b/vio/CMakeLists.txt
@@ -0,0 +1,6 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+
+ADD_DEFINITIONS(-DUSE_SYMDIR)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/extra/yassl/include)
+ADD_LIBRARY(vio vio.c viosocket.c viossl.c viosslfactories.c)
diff --git a/win/Makefile.am b/win/Makefile.am
new file mode 100755
index 00000000000..05c01b61360
--- /dev/null
+++ b/win/Makefile.am
@@ -0,0 +1,21 @@
+# Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+## Process this file with automake to create Makefile.in
+EXTRA_DIST = build-vs71.bat build-vs8.bat build-vs8_x64.bat configure.js README
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/win/README b/win/README
new file mode 100644
index 00000000000..cbda33e1184
--- /dev/null
+++ b/win/README
@@ -0,0 +1,82 @@
+Windows building readme
+======================================
+
+----------------IMPORTANT----------------------------
+This readme outlines the instructions for building
+MySQL for Windows staring from version 5.0.
+This readme does not apply to MySQL versions 5.1
+or ealier.
+-----------------------------------------------------
+
+The Windows build system uses a tool named CMake to generate build files for
+a variety of project systems. This tool is combined with a set of jscript
+files to enable building of MySQL for Windows directly out of a bk clone.
+The steps required are below.
+
+Step 1
+------
+Download and install CMake. It can be downloaded from http://www.cmake.org.
+Once it is installed, modify your path to make sure you can execute
+the cmake binary.
+
+Step 2
+------
+Download and install bison for Windows. It can be downloaded from
+http://gnuwin32.sourceforge.net/packages/bison.htm. Please download using
+the link named "Complete package, excluding sources". This includes an
+installer that will install bison. After the installer finishes, modify
+your path so that you can execute bison.
+
+Step 3
+------
+Clone your bk tree to any location you like.
+
+Step 4
+------
+From the root of your bk clone, execute the command: win\configure <options>.
+The options right now are
+
+ WITH_INNOBASE_STORAGE_ENGINE Enable particular storage engines
+ WITH_PARTITION_STORAGE_ENGINE
+ WITH_ARCHIVE_STORAGE_ENGINE
+ WITH_BERKELEY_STORAGE_ENGINE
+ WITH_BLACKHOLE_STORAGE_ENGINE
+ WITH_EXAMPLE_STORAGE_ENGINE
+ WITH_FEDERATED_STORAGE_ENGINE
+ WITH_INNOBASE_STORAGE_ENGINE
+ __NT__ Enable named pipe support
+ MYSQL_SERVER_SUFFIX=<suffix> Server suffix, default none
+ COMPILATION_COMMENT=<comment> Server comment, default "Source distribution"
+ MYSQL_TCP_PORT=<port> Server port, default 3306
+ CYBOZU
+
+So the command line could look like:
+
+win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
+
+Step 5
+------
+From the root of your bk clone, execute one of the batch files to generate the type
+of project files you desire.
+
+For Visual Studio 8, do win\build-vs8.
+For Visual Studio 7.1, do win\build-vs71.
+
+We will support building with nmake in the near future.
+
+Step 6
+------
+From the root of your bk clone, start your build.
+
+For Visual Studio, simply execute mysql.sln. This will start the IDE and you can
+click the build solution menu option.
+
+Current issues
+--------------
+1. After changing configuration (eg. adding or removing a storage engine), it
+may be necessary to clean the build tree to remove any stale objects.
+
+2. To use Visual C++ Express Edition you also need to install the Platform SDK.
+Please see this link: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
+At step 4 you only need to add the libraries advapi32.lib and user32.lib to
+the file "corewin_express.vsprops" in order to avoid link errors.
diff --git a/win/build-vs71.bat b/win/build-vs71.bat
new file mode 100755
index 00000000000..959067695c5
--- /dev/null
+++ b/win/build-vs71.bat
@@ -0,0 +1,7 @@
+@echo off
+
+if exist cmakecache.txt del cmakecache.txt
+copy win\vs71cache.txt cmakecache.txt
+cmake -G "Visual Studio 7 .NET 2003"
+copy cmakecache.txt win\vs71cache.txt
+
diff --git a/win/build-vs8.bat b/win/build-vs8.bat
new file mode 100755
index 00000000000..d9c06241a9b
--- /dev/null
+++ b/win/build-vs8.bat
@@ -0,0 +1,6 @@
+@echo off
+
+if exist cmakecache.txt del cmakecache.txt
+copy win\vs8cache.txt cmakecache.txt
+cmake -G "Visual Studio 8 2005"
+copy cmakecache.txt win\vs8cache.txt
diff --git a/win/build-vs8_x64.bat b/win/build-vs8_x64.bat
new file mode 100755
index 00000000000..f1d96116390
--- /dev/null
+++ b/win/build-vs8_x64.bat
@@ -0,0 +1,6 @@
+@echo off
+
+if exist cmakecache.txt del cmakecache.txt
+copy win\vs8cache.txt cmakecache.txt
+cmake -G "Visual Studio 8 2005 Win64"
+copy cmakecache.txt win\vs8cache.txt
diff --git a/win/configure.js b/win/configure.js
new file mode 100755
index 00000000000..ef90ce982a6
--- /dev/null
+++ b/win/configure.js
@@ -0,0 +1,166 @@
+// Configure.js
+
+ForReading = 1;
+ForWriting = 2;
+ForAppending = 8;
+
+try
+{
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+
+ var args = WScript.Arguments
+
+ // read in the Unix configure.in file
+ var configureInTS = fso.OpenTextFile("configure.in", ForReading);
+ var configureIn = configureInTS.ReadAll();
+ configureInTS.Close();
+ var default_comment = "Source distribution";
+ var default_port = GetValue(configureIn, "MYSQL_TCP_PORT_DEFAULT");
+
+ var configfile = fso.CreateTextFile("win\\configure.data", true);
+ for (i=0; i < args.Count(); i++)
+ {
+ var parts = args.Item(i).split('=');
+ switch (parts[0])
+ {
+ case "WITH_ARCHIVE_STORAGE_ENGINE":
+ case "WITH_BERKELEY_STORAGE_ENGINE":
+ case "WITH_BLACKHOLE_STORAGE_ENGINE":
+ case "WITH_EXAMPLE_STORAGE_ENGINE":
+ case "WITH_FEDERATED_STORAGE_ENGINE":
+ case "WITH_INNOBASE_STORAGE_ENGINE":
+ case "WITH_PARTITION_STORAGE_ENGINE":
+ case "__NT__":
+ case "CYBOZU":
+ configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
+ break;
+ case "MYSQL_SERVER_SUFFIX":
+ configfile.WriteLine("SET (" + parts[0] + " \""
+ + parts[1] + "\")");
+ break;
+ case "COMPILATION_COMMENT":
+ default_comment = parts[1];
+ break;
+ case "MYSQL_TCP_PORT":
+ default_port = parts[1];
+ break;
+ }
+ }
+
+ configfile.WriteLine("SET (COMPILATION_COMMENT \"" +
+ default_comment + "\")");
+
+ configfile.WriteLine("SET (PROTOCOL_VERSION \"" +
+ GetValue(configureIn, "PROTOCOL_VERSION") + "\")");
+ configfile.WriteLine("SET (DOT_FRM_VERSION \"" +
+ GetValue(configureIn, "DOT_FRM_VERSION") + "\")");
+ configfile.WriteLine("SET (MYSQL_TCP_PORT \"" + default_port + "\")");
+ configfile.WriteLine("SET (MYSQL_UNIX_ADDR \"" +
+ GetValue(configureIn, "MYSQL_UNIX_ADDR_DEFAULT") + "\")");
+ var version = GetVersion(configureIn);
+ configfile.WriteLine("SET (VERSION \"" + version + "\")");
+ configfile.WriteLine("SET (MYSQL_BASE_VERSION \"" +
+ GetBaseVersion(version) + "\")");
+ configfile.WriteLine("SET (MYSQL_VERSION_ID \"" +
+ GetVersionId(version) + "\")");
+
+ configfile.Close();
+
+ //ConfigureBDB();
+
+ fso = null;
+
+ WScript.Echo("done!");
+}
+catch (e)
+{
+ WScript.Echo("Error: " + e.description);
+}
+
+function GetValue(str, key)
+{
+ var pos = str.indexOf(key+'=');
+ if (pos == -1) return null;
+ pos += key.length + 1;
+ var end = str.indexOf("\n", pos);
+ if (str.charAt(pos) == "\"")
+ pos++;
+ if (str.charAt(end-1) == "\"")
+ end--;
+ return str.substring(pos, end);
+}
+
+function GetVersion(str)
+{
+ var key = "AM_INIT_AUTOMAKE(mysql, ";
+ var pos = str.indexOf(key); //5.0.6-beta)
+ if (pos == -1) return null;
+ pos += key.length;
+ var end = str.indexOf(")", pos);
+ if (end == -1) return null;
+ return str.substring(pos, end);
+}
+
+function GetBaseVersion(version)
+{
+ var dot = version.indexOf(".");
+ if (dot == -1) return null;
+ dot = version.indexOf(".", dot+1);
+ if (dot == -1) dot = version.length;
+ return version.substring(0, dot);
+}
+
+function GetVersionId(version)
+{
+ var dot = version.indexOf(".");
+ if (dot == -1) return null;
+ var major = parseInt(version.substring(0, dot), 10);
+
+ dot++;
+ var nextdot = version.indexOf(".", dot);
+ if (nextdot == -1) return null;
+ var minor = parseInt(version.substring(dot, nextdot), 10);
+ dot = nextdot+1;
+
+ var stop = version.indexOf("-", dot);
+ if (stop == -1) stop = version.length;
+ var build = parseInt(version.substring(dot, stop), 10);
+
+ var id = major;
+ if (minor < 10)
+ id += '0';
+ id += minor;
+ if (build < 10)
+ id += '0';
+ id += build;
+ return id;
+}
+
+function ConfigureBDB()
+{
+ // read in the Unix configure.in file
+ var dbIncTS = fso.OpenTextFile("..\\bdb\\dbinc\\db.in", ForReading);
+ var dbIn = dbIncTS.ReadAll();
+ dbIncTS.Close();
+
+ dbIn = dbIn.replace("@DB_VERSION_MAJOR@", "$DB_VERSION_MAJOR");
+ dbIn = dbIn.replace("@DB_VERSION_MINOR@", "$DB_VERSION_MINOR");
+ dbIn = dbIn.replace("@DB_VERSION_PATCH@", "$DB_VERSION_PATCH");
+ dbIn = dbIn.replace("@DB_VERSION_STRING@", "$DB_VERSION_STRING");
+
+ dbIn = dbIn.replace("@u_int8_decl@", "typedef unsigned char u_int8_t;");
+ dbIn = dbIn.replace("@int16_decl@", "typedef short int16_t;");
+ dbIn = dbIn.replace("@u_int16_decl@", "typedef unsigned short u_int16_t;");
+ dbIn = dbIn.replace("@int32_decl@", "typedef int int32_t;");
+ dbIn = dbIn.replace("@u_int32_decl@", "typedef unsigned int u_int32_t;");
+
+ dbIn = dbIn.replace("@u_char_decl@", "{\r\n#if !defined(_WINSOCKAPI_)\r\n" +
+ "typedef unsigned char u_char;");
+ dbIn = dbIn.replace("@u_short_decl@", "typedef unsigned short u_short;");
+ dbIn = dbIn.replace("@u_int_decl@", "typedef unsigned int u_int;");
+ dbIn = dbIn.replace("@u_long_decl@", "typedef unsigned long u_long;");
+
+ dbIn = dbIn.replace("@ssize_t_decl@", "#endif\r\n#if defined(_WIN64)\r\n" +
+ "typedef __int64 ssize_t;\r\n#else\r\n" +
+ "typedef int ssize_t;\r\n#endif");
+}
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
new file mode 100755
index 00000000000..53560adf6d1
--- /dev/null
+++ b/zlib/CMakeLists.txt
@@ -0,0 +1,8 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
+
+ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT -D__WIN32__)
+ADD_LIBRARY(zlib adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.c infback.c inffast.c inffast.h
+ inffixed.h inflate.c inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h zlib.h
+ zutil.c zutil.h)
+ \ No newline at end of file