@@ -57,8 +57,8 @@ add_config_option(WITH_MYSQL PATH
57
57
"Base location of (monolithic) MySQL installation."
58
58
)
59
59
60
- add_config_option (MYSQL_INCLUDE_DIR PATH "Path to MYSQL headers." )
61
- add_config_option (MYSQL_LIB_DIR PATH "Path to MYSQL libraries." )
60
+ add_config_option (MYSQL_INCLUDE_DIR PATH ADVANCED "Path to MYSQL headers." )
61
+ add_config_option (MYSQL_LIB_DIR PATH ADVANCED "Path to MYSQL libraries." )
62
62
63
63
64
64
function (main )
@@ -235,13 +235,6 @@ function(main)
235
235
PROPERTY VERSION ${MYSQL_VERSION}
236
236
)
237
237
238
- # Setting this should ensure that bundled external dependencies are used,
239
- # if available.
240
-
241
- set_property (TARGET MySQL::client-static
242
- PROPERTY INTERFACE_LINK_DIRECTORIES "${MYSQL_DIR} /lib" "${MYSQL_DIR} /bin"
243
- )
244
-
245
238
#
246
239
# Detect shared libraries on which MySQL client lib depends (if possible).
247
240
# Stores result in MYSQL_EXTERNAL_DEPENDENCIES.
@@ -253,6 +246,20 @@ function(main)
253
246
message (" include path: ${MYSQL_INCLUDE_DIR} " )
254
247
message (" library location: ${MYSQL_LIB} " )
255
248
249
+ # Using INTERFACE_LINK_LIBRARIES we ensure that -L option will appear
250
+ # in the link line of the consumer of this library. Adding this -L option
251
+ # is needed to resolve dependencies, such as -lssl, to the libraries that
252
+ # are bundled with the server.
253
+ #
254
+ # Note: This must be done before populating INTERFACE_LINK_LIBRARIES with
255
+ # the dependencies themselves.
256
+
257
+ if (NOT MSVC )
258
+ set_property (TARGET MySQL::client-static
259
+ PROPERTY INTERFACE_LINK_LIBRARIES "-L${MYSQL_DIR} /lib"
260
+ )
261
+ endif ()
262
+
256
263
if (MYSQL_EXTERNAL_DEPENDENCIES )
257
264
string (REPLACE ";" " " deps "${MYSQL_EXTERNAL_DEPENDENCIES} " )
258
265
message (" dependencies: ${deps} " )
@@ -267,6 +274,7 @@ function(main)
267
274
268
275
endif ()
269
276
277
+
270
278
endfunction (main )
271
279
272
280
0 commit comments