changeset 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 d0b02fd48a92
children 6c58af430ba0 063aa53b5917
files Resources/CMake/MariaDBConfiguration.cmake
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/MariaDBConfiguration.cmake	Mon Jun 29 19:20:45 2020 +0200
+++ b/Resources/CMake/MariaDBConfiguration.cmake	Mon Jun 29 19:22:34 2020 +0200
@@ -148,10 +148,20 @@
     message(FATAL_ERROR "Please install the libmysqlclient-dev package")
   endif()
 
-  check_library_exists(mysqlclient mysql_init "" HAVE_MYSQL_CLIENT_LIB)
-  if (NOT HAVE_MYSQL_CLIENT_LIB)
-    message(FATAL_ERROR "Unable to find the mysqlclient library")
-  endif()
-
-  link_libraries(mysqlclient)
+  find_library(MYSQL_CLIENT_LIB NAMES mysqlclient PATHS
+    /usr/lib/mysql
+    /usr/local/lib/mysql
+    )
+  
+  if (MYSQL_CLIENT_LIB)
+    check_library_exists(${MYSQL_CLIENT_LIB} mysql_init "" HAVE_MYSQL_CLIENT_LIB)
+    if (NOT HAVE_MYSQL_CLIENT_LIB)
+      message(FATAL_ERROR "Unable to use mysql_init from mysqlclient library")
+    endif()    
+    get_filename_component(MYSQL_CLIENT_LIB_PATH ${MYSQL_CLIENT_LIB} DIRECTORY)
+    link_directories(${MYSQL_CLIENT_LIB_PATH})
+    link_libraries(mysqlclient)
+  else()
+     message(FATAL_ERROR "Unable to find the mysqlclient library")
+   endif()
 endif()