Skip to content

Commit ddb70c4

Browse files
committed
Bug#35604758: Test programs use system path for openssl libs even if WITH_SSL used for cmake
1 parent 17c8307 commit ddb70c4

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

jdbc/CMakeLists.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ add_library(otel_api INTERFACE)
154154
if(NOT (WIN32 OR APPLE OR CMAKE_SYSTEM_NAME MATCHES "SunOS"))
155155
message(STATUS "Adding OTel support")
156156
set(TELEMETRY ON)
157-
target_include_directories(otel_api INTERFACE
157+
target_include_directories(otel_api INTERFACE
158158
"${PROJECT_SOURCE_DIR}/extra/otel/opentelemetry-cpp-1.8.3/api/include"
159159
)
160160
target_compile_definitions(otel_api INTERFACE TELEMETRY)
@@ -257,6 +257,25 @@ set(INFO_PREFIX "jdbc-")
257257
merge_libraries(connector-jdbc jdbc)
258258

259259

260+
# Note: When connector links statically to the client library, targets using
261+
# the connector must be able to find dependencies of the client library, such
262+
# as openssl libs. The MYSQL_EXTERNAL_SEARCHPATH variable set by DepFindMySQL.
263+
# cmake stores detected locations where client library dependencies that
264+
# are bundled with it can be found. We add it here as interface property
265+
# so that other targets that link with the connector will have library search
266+
# path correctly set in the compile line.
267+
#
268+
# TODO: Modify merge_libraries() logic to autmatically detect transitive link
269+
# directory path properties of merged targets and then set them on the merged
270+
# library target.
271+
272+
if(MYSQLCLIENT_STATIC_LINKING)
273+
target_link_directories(connector-jdbc INTERFACE
274+
${MYSQL_EXTERNAL_SEARCHPATH}
275+
)
276+
endif()
277+
278+
260279
#
261280
# Install specifications
262281
# ----------------------

0 commit comments

Comments
 (0)