Skip to content

Commit

Permalink
cleanup: specifying plugin dependencies in CMakeLists.txt
Browse files Browse the repository at this point in the history
1. rename option DEPENDENCIES in MYSQL_ADD_PLUGIN() to DEPENDS
   to be consistent with other cmake commands and macros

2. use this DEPENDS option in plugins

3. add dependencies to the plugin embedded target too

4. plugins don't need to add GenError dependency explicitly,
   all plugins depend on it automatically
  • Loading branch information
vuvova committed Aug 3, 2021
1 parent b549af6 commit 175c9fe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
14 changes: 7 additions & 7 deletions cmake/plugin.cmake
Expand Up @@ -26,13 +26,13 @@ INCLUDE(CMakeParseArguments)
# [STATIC_OUTPUT_NAME static_name]
# [RECOMPILE_FOR_EMBEDDED]
# [LINK_LIBRARIES lib1...libN]
# [DEPENDENCIES target1...targetN]
# [DEPENDS target1...targetN]

MACRO(MYSQL_ADD_PLUGIN)
CMAKE_PARSE_ARGUMENTS(ARG
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;CLIENT"
"MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
"LINK_LIBRARIES;DEPENDENCIES"
"LINK_LIBRARIES;DEPENDS"
${ARGN}
)
IF(NOT WITHOUT_SERVER OR ARG_CLIENT)
Expand Down Expand Up @@ -111,8 +111,8 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
UNSET(${with_var} CACHE)

IF(NOT ARG_DEPENDENCIES)
SET(ARG_DEPENDENCIES)
IF(NOT ARG_DEPENDS)
SET(ARG_DEPENDS)
ENDIF()

IF(NOT ARG_MODULE_OUTPUT_NAME)
Expand All @@ -138,7 +138,7 @@ MACRO(MYSQL_ADD_PLUGIN)

ADD_LIBRARY(${target} STATIC ${SOURCES})
DTRACE_INSTRUMENT(${target})
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDS})
RESTRICT_SYMBOL_EXPORTS(${target})
IF(WITH_EMBEDDED_SERVER)
# Embedded library should contain PIC code and be linkable
Expand All @@ -152,7 +152,7 @@ MACRO(MYSQL_ADD_PLUGIN)
SET_TARGET_PROPERTIES(${target}_embedded
PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY")
ENDIF()
ADD_DEPENDENCIES(${target}_embedded GenError)
ADD_DEPENDENCIES(${target}_embedded GenError ${ARG_DEPENDS})
ENDIF()
ENDIF()

Expand Down Expand Up @@ -213,7 +213,7 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} "-Wl,--no-undefined")
ENDIF()

ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDS})

SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
Expand Down
4 changes: 0 additions & 4 deletions storage/innobase/CMakeLists.txt
Expand Up @@ -188,7 +188,3 @@ IF(MSVC)
ENDIF()

ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)

IF(TARGET innobase)
ADD_DEPENDENCIES(innobase GenError)
ENDIF()
5 changes: 3 additions & 2 deletions storage/perfschema/CMakeLists.txt
Expand Up @@ -187,9 +187,10 @@ table_session_connect_attrs.cc
table_session_account_connect_attrs.cc
)

MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT STATIC_ONLY)
MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT
STATIC_ONLY DEPENDS GenServerSource)

IF (TARGET perfschema)
ADD_DEPENDENCIES(perfschema GenServerSource)
IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest)
ENDIF(WITH_UNIT_TESTS)
Expand Down
1 change: 0 additions & 1 deletion storage/xtradb/CMakeLists.txt
Expand Up @@ -524,7 +524,6 @@ IF(TARGET xtradb)
IF(NOT XTRADB_OK)
MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
ENDIF()
ADD_DEPENDENCIES(xtradb GenError)
ENDIF()

ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)

0 comments on commit 175c9fe

Please sign in to comment.