Skip to content

Commit d40c2a4

Browse files
committed
Bug#24555770: X PLUGIN FILES ARE BUILT WITH DIFFERENT OPTIONS
Change how X plugin is built. Use a single MYSQL_ADD_PLUGIN rather than ADD_CONVENIENCE_LIBRARY + MYSQL_ADD_PLUGIN. This ensures that all files are built in the same way.
1 parent 7a5145e commit d40c2a4

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

rapid/plugin/x/CMakeLists.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ ELSE()
111111
SET(xplugin_PROTOBUF_LIB ${PROTOBUF_LITE_LIBRARY})
112112
ENDIF()
113113

114+
# Do not LINK_LIBRARIES below, do TARGET_LINK_LIBRARIES instead.
115+
IF(WITH_PROTOBUF STREQUAL "system")
116+
SET(xplugin_PROTOBUF_LIB)
117+
ENDIF()
118+
114119
IF(MSVC)
115120
ADD_COMPILE_FLAGS(${PROTO_SRCS} ${PROTO_LITE_SRCS} COMPILE_FLAGS "/wd4018")
116121
ENDIF(MSVC)
@@ -124,10 +129,6 @@ ELSE()
124129
${BOOST_SOURCES_DIR}/libs/atomic/src/lockpool.cpp)
125130
ENDIF()
126131

127-
# Built *without* -DMYSQL_DYNAMIC_PLUGIN
128-
ADD_CONVENIENCE_LIBRARY(xplugin
129-
${xplugin_SRC} ${xplugin_HDRS} ${xplugin_PROTOBUF_SRC} ${BOOST_LIB_SOURCES})
130-
131132
ADD_COMPILE_FLAGS(
132133
src/xpl_plugin.cc
133134
src/xpl_performance_schema.cc
@@ -136,21 +137,20 @@ ELSE()
136137
"-I${xplugin_PROTOBUF_DIR}"
137138
"-I${CMAKE_CURRENT_BINARY_DIR}/generated/")
138139

139-
TARGET_LINK_LIBRARIES(xplugin ${LIBEVENT_LIBRARY} ${LIBEVENT_LIBRARIES})
140-
IF(MSVC)
141-
TARGET_LINK_LIBRARIES(xplugin strings)
142-
ENDIF(MSVC)
143-
144-
# These are built *with* -DMYSQL_DYNAMIC_PLUGIN
145140
MYSQL_ADD_PLUGIN(mysqlx
146141
src/xpl_plugin.cc
147142
src/xpl_performance_schema.cc
148-
LINK_LIBRARIES xplugin ${xplugin_PROTOBUF_LIB}
143+
${xplugin_SRC} ${xplugin_HDRS} ${xplugin_PROTOBUF_SRC} ${BOOST_LIB_SOURCES}
144+
LINK_LIBRARIES ${xplugin_PROTOBUF_LIB} ${LIBEVENT_LIBRARY} ${LIBEVENT_LIBRARIES}
149145
MODULE_ONLY MODULE_OUTPUT_NAME "mysqlx")
150146

151-
ADD_DEPENDENCIES(xplugin GenError)
147+
IF(WITH_PROTOBUF STREQUAL "system")
148+
TARGET_LINK_LIBRARIES(mysqlx "${PROTOBUF_LIBRARY}")
149+
ENDIF()
150+
151+
ADD_DEPENDENCIES(mysqlx GenError)
152152
IF (WITH_LIBEVENT STREQUAL "bundled")
153-
ADD_DEPENDENCIES(xplugin ${LIBEVENT_LIBRARY})
153+
ADD_DEPENDENCIES(mysqlx ${LIBEVENT_LIBRARY})
154154
ENDIF()
155155

156156
IF(XPLUGIN_LOG_PROTOBUF)

rapid/unittest/gunit/xplugin/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ INCLUDE(CTest)
2626
INCLUDE(${PROJECT_SOURCE_DIR}/rapid/plugin/x/mysqlx_protobuf.cmake)
2727

2828
INCLUDE(${PROJECT_SOURCE_DIR}/rapid/plugin/x/source_files.cmake)
29-
LIST(REMOVE_ITEM xplugin_SRC "${MYSQLX_PROJECT_DIR}/src/mysql_variables.cc")
3029

3130
MYSQLX_PROTOBUF_GENERATE_CPP_NAMES(protobuf_SRC ${PROTOBUF_MYSQLX_FILES})
3231

@@ -127,7 +126,6 @@ ENDIF(WIN32)
127126

128127
TARGET_LINK_LIBRARIES(
129128
xplugin_unit_tests
130-
xplugin
131129
gtest
132130
regex
133131
gmock

0 commit comments

Comments
 (0)