pica/cmake/FindMariaDB.cmake

29 lines
967 B
CMake

#SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
#SPDX-License-Identifier: GPL-3.0-or-laterlater
find_library(MariaDB_CLIENT_LIBRARIES mysqlclient NAMES mariadbclient)
find_path(MariaDB_INCLUDE_DIR mysql/mysql.h)
if (MariaDB_CLIENT_LIBRARIES AND MariaDB_INCLUDE_DIR)
set(MariaDB_FOUND TRUE)
endif()
if (MariaDB_FOUND)
add_library(MariaDB::client SHARED IMPORTED)
set_target_properties(MariaDB::client PROPERTIES
IMPORTED_LOCATION "${MariaDB_CLIENT_LIBRARIES}"
INTERFACE_LINK_LIBRARIES "${MariaDB_CLIENT_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES ${MariaDB_INCLUDE_DIR}/mysql
)
if (NOT MariaDB_FIND_QUIETLY)
message(STATUS "Found MariaDB includes: ${MariaDB_INCLUDE_DIR}/mysql")
message(STATUS "Found MariaDB client library: ${MariaDB_CLIENT_LIBRARIES}")
endif ()
else ()
if (MariaDB_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find MariaDB development files")
endif ()
endif ()