Mercurial > hg > orthanc-databases
changeset 817:1994604b2aec
merge
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Mon, 01 Jun 2026 18:58:25 +0200 |
| parents | b9f2946c15df (current diff) 814994b3ba16 (diff) |
| children | f377801f5980 |
| files | |
| diffstat | 1 files changed, 42 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/CMake/MariaDBConfiguration.cmake Mon Jun 01 18:58:10 2026 +0200 +++ b/Resources/CMake/MariaDBConfiguration.cmake Mon Jun 01 18:58:25 2026 +0200 @@ -153,9 +153,12 @@ endif() else() + # The MariaDB and the MySQL client libraries provide the same C interface find_path(MYSQLCLIENT_INCLUDE_DIR mysql.h + /usr/include/mariadb + /usr/include/mysql + /usr/local/include/mariadb /usr/local/include/mysql - /usr/include/mysql ) if (MYSQLCLIENT_INCLUDE_DIR) @@ -165,23 +168,46 @@ check_include_file(mysql.h HAVE_MYSQL_CLIENT_H) if (NOT HAVE_MYSQL_CLIENT_H) - message(FATAL_ERROR "Please install the libmysqlclient-dev package") + message(FATAL_ERROR "Please install the libmariadb-dev or libmysqlclient-dev package") endif() - find_library(MYSQL_CLIENT_LIB NAMES mysqlclient PATHS - /usr/lib/mysql - /usr/local/lib/mysql + + # Select MariaDB client library by default, if available + find_library(MARIADB_CLIENT_LIB NAMES mariadbclient PATHS + /usr/lib/ + /usr/local/lib/ ) - - 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) + + if (MARIADB_CLIENT_LIB) + check_library_exists(${MARIADB_CLIENT_LIB} mysql_init "" HAVE_MARIADB_CLIENT_LIB) + if (NOT HAVE_MARIADB_CLIENT_LIB) + message(FATAL_ERROR "Unable to use mysql_init from mariadbclient library") + endif() + get_filename_component(MARIADB_CLIENT_LIB_PATH ${MARIADB_CLIENT_LIB} DIRECTORY) + link_directories(${MARIADB_CLIENT_LIB_PATH}) + link_libraries(mariadbclient) + else() - message(FATAL_ERROR "Unable to find the mysqlclient library") - endif() + + # No MariaDB client library, fallback to the MySQL client library + 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() + + # Neither the MariaDB, not the MySQL client library is available + message(FATAL_ERROR "Unable to find the mariadbclient or mysqlclient library") + + endif() + endif() endif()
