You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
7.0 KiB

19 years ago
  1. # Copyright (C) 2006 MySQL AB
  2. #
  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.
  6. #
  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.
  11. #
  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")
  16. SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
  17. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
  18. # Note that we don't link with the libraries "strings" or "mysys"
  19. # here, instead we recompile the files needed and include them
  20. # directly. This means we don't have to worry here about if these
  21. # libraries are compiled defining USE_TLS or not. Not that it *should*
  22. # have been a problem anyway, they don't use thread local storage.
  23. INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
  24. ${CMAKE_SOURCE_DIR}/libmysql
  25. ${CMAKE_SOURCE_DIR}/regex
  26. ${CMAKE_SOURCE_DIR}/sql
  27. ${CMAKE_SOURCE_DIR}/strings)
  28. # We include the source file listing instead of referencing the
  29. # libraries. At least with CMake 2.4 and Visual Studio 2005 a static
  30. # library created from other static libraries would not be complete,
  31. # i.e. the libraries listed in TARGET_LINK_LIBRARIES() were just
  32. # ignored.
  33. # Include and add the directory path
  34. SET(SOURCE_SUBLIBS TRUE)
  35. INCLUDE(${CMAKE_SOURCE_DIR}/zlib/CMakeLists.txt)
  36. FOREACH(rpath ${ZLIB_SOURCES})
  37. SET(LIB_SOURCES ${LIB_SOURCES} ../zlib/${rpath})
  38. ENDFOREACH(rpath)
  39. # FIXME only needed if build type is "Debug", but CMAKE_BUILD_TYPE is
  40. # not set during configure time.
  41. INCLUDE(${CMAKE_SOURCE_DIR}/dbug/CMakeLists.txt)
  42. FOREACH(rpath ${DBUG_SOURCES})
  43. SET(LIB_SOURCES ${LIB_SOURCES} ../dbug/${rpath})
  44. ENDFOREACH(rpath)
  45. INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/CMakeLists.txt)
  46. FOREACH(rpath ${TAOCRYPT_SOURCES})
  47. SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/taocrypt/${rpath})
  48. ENDFOREACH(rpath)
  49. INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/CMakeLists.txt)
  50. FOREACH(rpath ${YASSL_SOURCES})
  51. SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/${rpath})
  52. ENDFOREACH(rpath)
  53. SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
  54. ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
  55. ../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
  56. ../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
  57. ../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
  58. ../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
  59. ../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
  60. ../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
  61. ../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
  62. ../mysys/default.c errmsg.c ../mysys/errors.c
  63. ../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c
  64. get_password.c ../strings/int2str.c ../strings/is_prefix.c
  65. libmysql.c ../mysys/list.c ../strings/llstr.c
  66. ../strings/longlong2str.c manager.c ../mysys/mf_cache.c
  67. ../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
  68. ../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
  69. ../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
  70. ../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
  71. ../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
  72. ../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
  73. ../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
  74. ../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
  75. ../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
  76. ../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
  77. ../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
  78. ../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
  79. ../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
  80. ../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
  81. ../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
  82. ../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
  83. ../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
  84. ../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
  85. ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
  86. ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
  87. ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
  88. ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c
  89. ../mysys/my_getsystime.c ${LIB_SOURCES})
  90. # Need to set USE_TLS for building the DLL, since __declspec(thread)
  91. # approach to thread local storage does not work properly in DLLs.
  92. #
  93. # The static library might be used to form another DLL, as is the case
  94. # with the ODBC driver, so it has to be compiled with USE_TLS as well.
  95. #
  96. # We create a third library without USE_TLS for internal use. We can't
  97. # be sure that some client application part of this build doesn't go
  98. # beond the documented API, and try access the Thread Local Storage.
  99. # The "_notls" means no Tls*() functions used, i.e. "static" TLS.
  100. ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} dll.c libmysql.def)
  101. ADD_LIBRARY(mysqlclient STATIC ${CLIENT_SOURCES})
  102. ADD_LIBRARY(mysqlclient_notls STATIC ${CLIENT_SOURCES})
  103. SET_TARGET_PROPERTIES(libmysql mysqlclient PROPERTIES COMPILE_FLAGS "-DUSE_TLS")
  104. ADD_DEPENDENCIES(libmysql GenError)
  105. TARGET_LINK_LIBRARIES(libmysql wsock32)
  106. ADD_DEPENDENCIES(mysqlclient GenError)
  107. TARGET_LINK_LIBRARIES(mysqlclient)
  108. ADD_DEPENDENCIES(mysqlclient_notls GenError)
  109. TARGET_LINK_LIBRARIES(mysqlclient_notls)
  110. ADD_EXECUTABLE(myTest mytest.c)
  111. TARGET_LINK_LIBRARIES(myTest libmysql)
  112. IF(EMBED_MANIFESTS)
  113. MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
  114. ENDIF(EMBED_MANIFESTS)