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.

46 lines
1.9 KiB

  1. # MYSQL_STORAGE_ENGINE Macro creates a project to build storage engine
  2. # library.
  3. #
  4. # Parameters:
  5. # engine - storage engine name.
  6. # variable ENGINE_BUILD_TYPE should be set to "STATIC" or "DYNAMIC"
  7. # Remarks:
  8. # ${engine}_SOURCES variable containing source files to produce the library must set before
  9. # calling this macro
  10. # ${engine}_LIBS variable containing extra libraries to link with may be set
  11. MACRO(MYSQL_STORAGE_ENGINE engine)
  12. IF(NOT SOURCE_SUBLIBS)
  13. # Add common include directories
  14. INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
  15. ${CMAKE_SOURCE_DIR}/sql
  16. ${CMAKE_SOURCE_DIR}/regex
  17. ${CMAKE_SOURCE_DIR}/extra/yassl/include)
  18. STRING(TOUPPER ${engine} engine)
  19. STRING(TOLOWER ${engine} libname)
  20. IF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
  21. ADD_DEFINITIONS(-DWITH_${engine}_STORAGE_ENGINE -DMYSQL_SERVER)
  22. #Create static library. The name of the library is <storage_engine>.lib
  23. ADD_LIBRARY(${libname} ${${engine}_SOURCES})
  24. ADD_DEPENDENCIES(${libname} GenError)
  25. IF(${engine}_LIBS)
  26. TARGET_LINK_LIBRARIES(${libname} ${${engine}_LIBS})
  27. ENDIF(${engine}_LIBS)
  28. MESSAGE("build ${engine} as static library")
  29. ELSEIF(${ENGINE_BUILD_TYPE} STREQUAL "DYNAMIC")
  30. ADD_DEFINITIONS(-DMYSQL_DYNAMIC_PLUGIN)
  31. #Create a DLL.The name of the dll is ha_<storage_engine>.dll
  32. #The dll is linked to the mysqld executable
  33. SET(dyn_libname ha_${libname})
  34. ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
  35. TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld)
  36. IF(${engine}_LIBS)
  37. TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
  38. ENDIF(${engine}_LIBS)
  39. # Install the plugin
  40. INSTALL(TARGETS ${dyn_libname} DESTINATION lib/plugin COMPONENT runtime)
  41. MESSAGE("build ${engine} as DLL")
  42. ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
  43. ENDIF(NOT SOURCE_SUBLIBS)
  44. ENDMACRO(MYSQL_STORAGE_ENGINE)