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.

60 lines
2.5 KiB

  1. # Copyright (c) 2009 Sun Microsystems, Inc.
  2. # Use is subject to license terms.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; version 2 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. # MYSQL_STORAGE_ENGINE Macro creates a project to build storage engine
  17. # library.
  18. #
  19. # Parameters:
  20. # engine - storage engine name.
  21. # variable ENGINE_BUILD_TYPE should be set to "STATIC" or "DYNAMIC"
  22. # Remarks:
  23. # ${engine}_SOURCES variable containing source files to produce the library must set before
  24. # calling this macro
  25. # ${engine}_LIBS variable containing extra libraries to link with may be set
  26. MACRO(MYSQL_STORAGE_ENGINE engine)
  27. IF(NOT SOURCE_SUBLIBS)
  28. # Add common include directories
  29. INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
  30. ${CMAKE_SOURCE_DIR}/sql
  31. ${CMAKE_SOURCE_DIR}/regex
  32. ${CMAKE_SOURCE_DIR}/extra/yassl/include)
  33. STRING(TOUPPER ${engine} engine)
  34. STRING(TOLOWER ${engine} libname)
  35. IF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
  36. ADD_DEFINITIONS(-DWITH_${engine}_STORAGE_ENGINE -DMYSQL_SERVER)
  37. #Create static library. The name of the library is <storage_engine>.lib
  38. ADD_LIBRARY(${libname} ${${engine}_SOURCES})
  39. ADD_DEPENDENCIES(${libname} GenError)
  40. IF(${engine}_LIBS)
  41. TARGET_LINK_LIBRARIES(${libname} ${${engine}_LIBS})
  42. ENDIF(${engine}_LIBS)
  43. MESSAGE("build ${engine} as static library")
  44. ELSEIF(${ENGINE_BUILD_TYPE} STREQUAL "DYNAMIC")
  45. ADD_DEFINITIONS(-DMYSQL_DYNAMIC_PLUGIN)
  46. #Create a DLL.The name of the dll is ha_<storage_engine>.dll
  47. #The dll is linked to the mysqld executable
  48. SET(dyn_libname ha_${libname})
  49. ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
  50. TARGET_LINK_LIBRARIES (${dyn_libname} mysqld)
  51. IF(${engine}_LIBS)
  52. TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
  53. ENDIF(${engine}_LIBS)
  54. MESSAGE("build ${engine} as DLL")
  55. ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
  56. ENDIF(NOT SOURCE_SUBLIBS)
  57. ENDMACRO(MYSQL_STORAGE_ENGINE)