MySQL Internals Manual  /  Plugins  /  CMake Macro to Define the Plugin

5.2 CMake Macro to Define the Plugin

To define a plugin, you need to add the MYSQL_ADD_PLUGIN() macro into CMakeList.txt. Unlike in 5.1, there is no special script. If you need to perform system checks, use standard CMake techniques like CHECK_FUNCTION_EXISTS or CHECK_INCLUDE_FILE etc.

Note: There is NO autoheader-functionality. For example, CHECK_FUNCTION_EXISTS(epoll_wait HAVE_EPOLL_WAIT) will not automagically add "#define HAVE_EPOLL_WAIT 1" in config.h. Different plugins might chose different strategies to add plugin-specific defines

  • Strategy 1 - use ADD_DEFINITIONS

This is similar to what InnoDB does in 5.5. An example

  • Strategy 2 - use own header template

It is more work than in Strategy 1 but result is a cleaner solution:

1) You need to have plugin specific <plugin> with content similar to

 #cmakedefine HAVE_EPOLL_WAIT
#cmakedefine HAVE_EPOLL_CTL

2) In CMakeLists.txt, add system checks


After all system checks, add

CONFIGURE_FILE( plugin_config.h)

3) use #include "plugin_config.h" in your source files

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.