Commit db227616 authored by Sergei Golubchik's avatar Sergei Golubchik

followup for "MDEV-6248 GUI-friendly cmake options to enable/disable plugins"

Remove ONLY_IF clause in MYSQL_ADD_PLUGIN and the requirement
that every plugin's CMakeLists.txt *must* do MYSQL_ADD_PLUGIN
for PLUGIN_XXX=YES to work. This was very fragile and cannot be
relied on.

Use a different implementation of =YES check - iterate all
PLUGIN_* variables and see which one doesn't have a matching target.

Revert all ONLY_IF changes in CMakeLists.txt files.
parent 985ef1d4
......@@ -29,7 +29,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
MACRO(MYSQL_ADD_PLUGIN)
MYSQL_PARSE_ARGUMENTS(ARG
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG;ONLY_IF"
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED"
${ARGN}
)
......@@ -118,10 +118,6 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
ENDIF()
IF(ARG_ONLY_IF AND NOT ${ARG_ONLY_IF})
SET(ARG_DISABLED 1)
ENDIF()
# Build either static library or module
IF (PLUGIN_${plugin} MATCHES "(STATIC|AUTO|YES)" AND NOT ARG_MODULE_ONLY
AND NOT ARG_DISABLED)
......@@ -229,8 +225,6 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT})
#INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug COMPONENT ${ARG_COMPONENT})
ELSEIF(PLUGIN_${plugin} MATCHES "YES")
MESSAGE(FATAL_ERROR "Plugin ${plugin} cannot be built")
ENDIF()
GET_FILENAME_COMPONENT(subpath ${CMAKE_CURRENT_SOURCE_DIR} NAME)
......@@ -251,4 +245,15 @@ MACRO(CONFIGURE_PLUGINS)
ADD_SUBDIRECTORY(${dir})
ENDIF()
ENDFOREACH()
GET_CMAKE_PROPERTY(ALL_VARS VARIABLES)
FOREACH (V ${ALL_VARS})
IF (V MATCHES "^PLUGIN_" AND ${V} MATCHES "YES")
STRING(SUBSTRING ${V} 7 -1 plugin)
STRING(TOLOWER ${plugin} target)
IF (NOT TARGET ${target})
MESSAGE(FATAL_ERROR "Plugin ${plugin} cannot be built")
ENDIF()
ENDIF()
ENDFOREACH()
ENDMACRO()
......@@ -4,10 +4,10 @@ INCLUDE (CheckFunctionExists)
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
IF(HAVE_STRNDUP)
ADD_DEFINITIONS(-DHAVE_STRNDUP)
ENDIF(HAVE_STRNDUP)
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c ONLY_IF HAVE_PAM_APPL_H
LINK_LIBRARIES pam MODULE_ONLY)
IF(HAVE_PAM_APPL_H)
IF(HAVE_STRNDUP)
ADD_DEFINITIONS(-DHAVE_STRNDUP)
ENDIF(HAVE_STRNDUP)
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY)
ENDIF(HAVE_PAM_APPL_H)
......@@ -64,5 +64,6 @@ ENDIF()
ENDIF()
ENDIF()
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c ONLY_IF ok MODULE_ONLY)
IF(ok)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c MODULE_ONLY)
ENDIF()
......@@ -3,9 +3,8 @@ INCLUDE (CheckLibraryExists)
CHECK_INCLUDE_FILES (crack.h HAVE_CRACK_H)
CHECK_LIBRARY_EXISTS(crack FascistCheckUser "" HAVE_LIBCRACK)
IF (HAVE_ALLOCA_H AND HAVE_CRACK_H AND HAVE_LIBCRACK AND HAVE_MEMCPY)
SET(ok 1)
MYSQL_ADD_PLUGIN(cracklib_password_check cracklib_password_check.c
LINK_LIBRARIES crack MODULE_ONLY)
ENDIF()
MYSQL_ADD_PLUGIN(cracklib_password_check cracklib_password_check.c
LINK_LIBRARIES crack ONLY_IF ok MODULE_ONLY)
MYSQL_ADD_PLUGIN(EXAMPLE_KEY_MANAGEMENT_PLUGIN example_key_management_plugin.cc
MODULE_ONLY ONLY_IF HAVE_EncryptAes128Ctr)
IF(HAVE_EncryptAes128Ctr)
MYSQL_ADD_PLUGIN(EXAMPLE_KEY_MANAGEMENT_PLUGIN example_key_management_plugin.cc
MODULE_ONLY)
ENDIF()
SET(FILE_KEY_MANAGEMENT_PLUGIN_SOURCES file_key_management_plugin.cc EncKeys.cc KeySingleton.cc)
IF(NOT SSL_SOURCES)
SET(USING_OPENSSL ON)
MYSQL_ADD_PLUGIN(FILE_KEY_MANAGEMENT_PLUGIN ${FILE_KEY_MANAGEMENT_PLUGIN_SOURCES}
LINK_LIBRARIES pcre)
ENDIF()
MYSQL_ADD_PLUGIN(FILE_KEY_MANAGEMENT_PLUGIN ${FILE_KEY_MANAGEMENT_PLUGIN_SOURCES}
LINK_LIBRARIES pcre ONLY_IF USING_OPENSSL)
......@@ -51,9 +51,6 @@ LINK_DIRECTORIES(${LINK_DIR})
IF(CASSANDRASE_OK)
SET(CASSANDRA_DEB_FILES "usr/lib/mysql/plugin/ha_cassandra.so" PARENT_SCOPE)
MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE
MODULE_ONLY LINK_LIBRARIES thrift COMPONENT cassandra-engine)
ENDIF(CASSANDRASE_OK)
MYSQL_ADD_PLUGIN(cassandra ${cassandra_sources} STORAGE_ENGINE
ONLY_IF CASSANDRASE_OK
MODULE_ONLY LINK_LIBRARIES thrift COMPONENT cassandra-engine)
......@@ -50,17 +50,16 @@ IF(BOOST_OK)
ADD_DEFINITIONS(-DBOOST_NO_RTTI=1 -DBOOST_NO_TYPEID=1 -DBOOST_DISABLE_ASSERTS=1)
MESSAGE(STATUS "OQGraph OK")
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc
oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc
STORAGE_ENGINE
MODULE_ONLY
RECOMPILE_FOR_EMBEDDED
COMPONENT oqgraph-engine
LINK_LIBRARIES ${Judy_LIBRARIES})
ELSE(BOOST_OK)
MESSAGE(STATUS "Requisites for OQGraph not met. OQGraph will not be compiled")
ENDIF(BOOST_OK)
ENDFUNCTION()
CHECK_OQGRAPH()
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc
oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc
STORAGE_ENGINE
ONLY_IF BOOST_OK
MODULE_ONLY
RECOMPILE_FOR_EMBEDDED
COMPONENT oqgraph-engine
LINK_LIBRARIES ${Judy_LIBRARIES})
......@@ -10,7 +10,6 @@ int main() { return 0; }
ENDIF()
IF(NOT TOKUDB_OK OR PLUGIN_TOKUDB STREQUAL "NO")
MYSQL_ADD_PLUGIN(tokudb DISABLED)
RETURN()
ENDIF()
......
......@@ -458,12 +458,10 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc)
IF(NOT XTRADB_OK)
IF(XTRADB_OK)
MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
DEFAULT RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
ELSE()
MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
ENDIF()
MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
DEFAULT ONLY_IF XTRADB_OK
RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment