Skip to content

Commit 065899d

Browse files
authored
Fix the missing openssl dependency in FindMysql (#2360)
1 parent 1a92fa7 commit 065899d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

cmake_modules/FindMySQL.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,17 @@ find_package_handle_standard_args(MySQL
130130
MYSQL_INCLUDE_DIRS)
131131
# Copy the results to the output variables.
132132
if(MySQL_FOUND)
133-
add_library(MySQL_lib INTERFACE IMPORTED)
134-
set_target_properties(MySQL_lib
135-
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
136-
"${MYSQL_INCLUDE_DIRS}"
137-
INTERFACE_LINK_LIBRARIES
138-
"${MYSQL_LIBRARIES}")
133+
add_library(MySQL_lib UNKNOWN IMPORTED)
134+
set_target_properties(MySQL_lib PROPERTIES
135+
INTERFACE_INCLUDE_DIRECTORIES "${MYSQL_INCLUDE_DIRS}"
136+
IMPORTED_LOCATION "${MYSQL_LIBRARIES}")
137+
find_package(OpenSSL QUIET) # try to find openssl
138+
if(OpenSSL_FOUND)
139+
target_link_libraries(MySQL_lib INTERFACE $<LINK_ONLY:OpenSSL::SSL> $<LINK_ONLY:OpenSSL::Crypto>)
140+
message(STATUS "mysql: OpenSSL found!")
141+
else()
142+
message(STATUS "mysql: OpenSSL missing!")
143+
endif()
139144
else(MySQL_FOUND)
140145
set(MYSQL_LIBRARIES)
141146
set(MYSQL_INCLUDE_DIRS)

0 commit comments

Comments
 (0)