1
# Copyright (C) 2006 MySQL AB
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; version 2 of the License.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
17
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
18
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
20
# Note that we don't link with the libraries "strings" or "mysys"
21
# here, instead we recompile the files needed and include them
22
# directly. This means we don't have to worry here about if these
23
# libraries are compiled defining USE_TLS or not. Not that it *should*
24
# have been a problem anyway, they don't use thread local storage.
26
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
27
${CMAKE_SOURCE_DIR}/libmysql
28
${CMAKE_SOURCE_DIR}/regex
29
${CMAKE_SOURCE_DIR}/sql
30
${CMAKE_SOURCE_DIR}/strings)
32
# We include the source file listing instead of referencing the
33
# libraries. At least with CMake 2.4 and Visual Studio 2005 a static
34
# library created from other static libraries would not be complete,
35
# i.e. the libraries listed in TARGET_LINK_LIBRARIES() were just
39
# Include and add the directory path
40
SET(SOURCE_SUBLIBS TRUE)
43
INCLUDE(${CMAKE_SOURCE_DIR}/zlib/CMakeLists.txt)
44
FOREACH(rpath ${ZLIB_SOURCES})
45
SET(LIB_SOURCES ${LIB_SOURCES} ../zlib/${rpath})
48
# FIXME only needed if build type is "Debug", but CMAKE_BUILD_TYPE is
49
# not set during configure time.
50
INCLUDE(${CMAKE_SOURCE_DIR}/dbug/CMakeLists.txt)
51
FOREACH(rpath ${DBUG_SOURCES})
52
SET(LIB_SOURCES ${LIB_SOURCES} ../dbug/${rpath})
55
INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/CMakeLists.txt)
56
FOREACH(rpath ${TAOCRYPT_SOURCES})
57
SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/taocrypt/${rpath})
60
INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/CMakeLists.txt)
61
FOREACH(rpath ${YASSL_SOURCES})
62
SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/${rpath})
65
SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
66
../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
67
../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
68
../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
69
../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
70
../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
71
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
72
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
73
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
74
../mysys/default.c errmsg.c ../mysys/errors.c
75
../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c
76
get_password.c ../strings/int2str.c ../strings/is_prefix.c
77
libmysql.c ../mysys/list.c ../strings/llstr.c
78
../strings/longlong2str.c manager.c ../mysys/mf_arr_appstr.c ../mysys/mf_cache.c
79
../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
80
../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
81
../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
82
../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
83
../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
84
../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
85
../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
86
../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
87
../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
88
../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
89
../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
90
../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
91
../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
92
../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
93
../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
94
../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
95
../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
96
../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
97
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
98
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
99
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
100
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c ../mysys/mf_qsort.c
101
../mysys/my_getsystime.c ../mysys/my_sync.c ${LIB_SOURCES})
103
# Need to set USE_TLS for building the DLL, since __declspec(thread)
104
# approach to thread local storage does not work properly in DLLs.
106
# The static library might be used to form another DLL, as is the case
107
# with the ODBC driver, so it has to be compiled with USE_TLS as well.
109
# We create a third library without USE_TLS for internal use. We can't
110
# be sure that some client application part of this build doesn't go
111
# beond the documented API, and try access the Thread Local Storage.
112
# The "_notls" means no Tls*() functions used, i.e. "static" TLS.
114
ADD_LIBRARY(mysqlclient STATIC ${CLIENT_SOURCES})
115
ADD_DEPENDENCIES(mysqlclient GenError)
116
TARGET_LINK_LIBRARIES(mysqlclient)
118
ADD_LIBRARY(mysqlclient_notls STATIC ${CLIENT_SOURCES})
119
ADD_DEPENDENCIES(mysqlclient_notls GenError)
120
TARGET_LINK_LIBRARIES(mysqlclient_notls)
122
ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} dll.c libmysql.def)
124
SET_TARGET_PROPERTIES(libmysql mysqlclient PROPERTIES COMPILE_FLAGS "-DUSE_TLS")
126
ADD_DEPENDENCIES(libmysql GenError)
127
TARGET_LINK_LIBRARIES(libmysql wsock32)
130
MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
131
ENDIF(EMBED_MANIFESTS)