To define a plugin, you need to add the MYSQL_ADD_PLUGIN() macro into CMakeList.txt. Unlike in 5.1, there is no special plug.in 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
CHECK_FUNCTION_EXISTS(epoll_wait HAVE_EPOLL_WAIT) IF(HAVE_EPOLL_WAIT) ADD_DEFINITIONS(-DHAVE_EPOLL_WAIT=1) ENDIF()
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>_config.h.in with content similar to
#cmakedefine HAVE_EPOLL_WAIT #cmakedefine HAVE_EPOLL_CTL
2) In CMakeLists.txt, add system checks
CHECK_FUNCTION_EXISTS(epoll_wait HAVE_EPOLL_WAIT) CHECK_FUNCTION_EXISTS(epoll_ctl HAVE_EPOLL_CTL)
After all system checks, add
CONFIGURE_FILE(plugin_config.h.in plugin_config.h)
3) use #include "plugin_config.h" in your source files
