Warning, /multimedia/amarok/cmake/modules/FindMySQL.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to find MySQL library
0002 # Find the MySQL includes and client library
0003 # This module defines
0004 #  MYSQL_INCLUDE_DIR, where to find mysql.h
0005 #  MYSQL_LIBRARIES, the libraries needed to use MySQL.
0006 #  MySQL_FOUND, If false, do not try to use MySQL.
0007 
0008 # Copyright (c) 2006-2018, Jarosław Staniek <staniek@kde.org>
0009 #
0010 # Redistribution and use is allowed according to the terms of the BSD license.
0011 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0012 
0013 include(CheckCXXSourceCompiles)
0014 include(CMakePushCheckState)
0015 
0016 # First try to get information from mysql_config which might be a shell script
0017 # or an executable. Unfortunately not every distro has pkgconfig files for
0018 # MySQL/MariaDB.
0019 find_program(MYSQLCONFIG_EXECUTABLE
0020     NAMES mysql_config mysql_config5
0021     HINTS ${BIN_INSTALL_DIR}
0022 )
0023 
0024 if(MYSQLCONFIG_EXECUTABLE)
0025     execute_process(
0026         COMMAND ${MYSQLCONFIG_EXECUTABLE} --libs
0027         RESULT_VARIABLE MC_return_libraries
0028         OUTPUT_VARIABLE MYSQL_LIBRARIES
0029         OUTPUT_STRIP_TRAILING_WHITESPACE
0030     )
0031 endif()
0032 
0033 # Try searching manually via find_path/find_library,  possibly with hints
0034 # from pkg-config
0035 find_package(PkgConfig)
0036 pkg_check_modules(PC_MYSQL QUIET mysql mariadb)
0037 
0038 find_path(MYSQL_INCLUDE_DIR mysql.h
0039     PATHS
0040         $ENV{MYSQL_INCLUDE_DIR}
0041         $ENV{MYSQL_DIR}/include
0042         ${PC_MYSQL_INCLUDEDIR}
0043         ${PC_MYSQL_INCLUDE_DIRS}
0044         /usr/local/mysql/include
0045         /opt/mysql/mysql/include
0046     PATH_SUFFIXES
0047     mysql
0048 )
0049 
0050 if(NOT MYSQL_LIBRARIES)
0051     find_library(MYSQL_LIBRARIES NAMES mysqlclient
0052         PATHS
0053             $ENV{MYSQL_DIR}/libmysql_r/.libs
0054             $ENV{MYSQL_DIR}/lib
0055             $ENV{MYSQL_DIR}/lib/mysql
0056             ${PC_MYSQL_LIBDIR}
0057             ${PC_MYSQL_LIBRARY_DIRS}
0058         PATH_SUFFIXES
0059             mysql
0060    )
0061 endif()
0062 
0063 if(PC_MYSQL_VERSION)
0064     set(MySQL_VERSION_STRING ${PC_MYSQL_VERSION})
0065 endif()
0066 
0067 include(FindPackageHandleStandardArgs)
0068 
0069 find_package_handle_standard_args(MySQL
0070     REQUIRED_VARS MYSQL_LIBRARIES MYSQL_INCLUDE_DIR
0071     VERSION_VAR MySQL_VERSION_STRING
0072 )
0073 
0074 mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES)
0075 
0076 set_package_properties(MySQL PROPERTIES
0077     DESCRIPTION "MySQL Client Library (libmysqlclient)"
0078     URL "https://www.mysql.com"
0079 )