comparison Resources/CMake/MariaDBConfiguration.cmake @ 150:d9101318442d

fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Jun 2020 19:22:34 +0200
parents 4cd7e45b671e
children 2f94b2046d7c
comparison
equal deleted inserted replaced
149:d0b02fd48a92 150:d9101318442d
146 check_include_file(mysql.h HAVE_MYSQL_CLIENT_H) 146 check_include_file(mysql.h HAVE_MYSQL_CLIENT_H)
147 if (NOT HAVE_MYSQL_CLIENT_H) 147 if (NOT HAVE_MYSQL_CLIENT_H)
148 message(FATAL_ERROR "Please install the libmysqlclient-dev package") 148 message(FATAL_ERROR "Please install the libmysqlclient-dev package")
149 endif() 149 endif()
150 150
151 check_library_exists(mysqlclient mysql_init "" HAVE_MYSQL_CLIENT_LIB) 151 find_library(MYSQL_CLIENT_LIB NAMES mysqlclient PATHS
152 if (NOT HAVE_MYSQL_CLIENT_LIB) 152 /usr/lib/mysql
153 message(FATAL_ERROR "Unable to find the mysqlclient library") 153 /usr/local/lib/mysql
154 endif() 154 )
155 155
156 link_libraries(mysqlclient) 156 if (MYSQL_CLIENT_LIB)
157 check_library_exists(${MYSQL_CLIENT_LIB} mysql_init "" HAVE_MYSQL_CLIENT_LIB)
158 if (NOT HAVE_MYSQL_CLIENT_LIB)
159 message(FATAL_ERROR "Unable to use mysql_init from mysqlclient library")
160 endif()
161 get_filename_component(MYSQL_CLIENT_LIB_PATH ${MYSQL_CLIENT_LIB} DIRECTORY)
162 link_directories(${MYSQL_CLIENT_LIB_PATH})
163 link_libraries(mysqlclient)
164 else()
165 message(FATAL_ERROR "Unable to find the mysqlclient library")
166 endif()
157 endif() 167 endif()