blob: 50db58237bba34c1ee538421ce1f76d06dfa4e16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#.rst:
# FindMySqlClient
# ---------------
# Finds the MySqlClient library
#
# This will will define the following variables::
#
# MYSQLCLIENT_FOUND - system has MySqlClient
# MYSQLCLIENT_INCLUDE_DIRS - the MySqlClient include directory
# MYSQLCLIENT_LIBRARIES - the MySqlClient libraries
# MYSQLCLIENT_DEFINITIONS - the MySqlClient compile definitions
#
# and the following imported targets::
#
# MySqlClient::MySqlClient - The MySqlClient library
# Don't find system wide installed version on Windows
if(WIN32)
set(EXTRA_FIND_ARGS NO_SYSTEM_ENVIRONMENT_PATH)
else()
set(EXTRA_FIND_ARGS)
endif()
find_path(MYSQLCLIENT_INCLUDE_DIR NAMES mysql/mysql.h mysql/server/mysql.h)
find_library(MYSQLCLIENT_LIBRARY_RELEASE NAMES mysqlclient libmysql
PATH_SUFFIXES mysql
${EXTRA_FIND_ARGS})
find_library(MYSQLCLIENT_LIBRARY_DEBUG NAMES mysqlclient libmysql
PATH_SUFFIXES mysql
${EXTRA_FIND_ARGS})
if(MYSQLCLIENT_INCLUDE_DIR AND EXISTS "${MYSQLCLIENT_INCLUDE_DIR}/mysql/mysql_version.h")
file(STRINGS "${MYSQLCLIENT_INCLUDE_DIR}/mysql/mysql_version.h" mysql_version_str REGEX "^#define[\t ]+LIBMYSQL_VERSION[\t ]+\".*\".*")
string(REGEX REPLACE "^#define[\t ]+LIBMYSQL_VERSION[\t ]+\"([^\"]+)\".*" "\\1" MYSQLCLIENT_VERSION_STRING "${mysql_version_str}")
unset(mysql_version_str)
endif()
include(SelectLibraryConfigurations)
select_library_configurations(MYSQLCLIENT)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MySqlClient
REQUIRED_VARS MYSQLCLIENT_LIBRARY MYSQLCLIENT_INCLUDE_DIR
VERSION_VAR MYSQLCLIENT_VERSION_STRING)
if(MYSQLCLIENT_FOUND)
set(MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARY})
set(MYSQLCLIENT_INCLUDE_DIRS ${MYSQLCLIENT_INCLUDE_DIR})
set(MYSQLCLIENT_DEFINITIONS -DHAS_MYSQL=1)
if(NOT TARGET MySqlClient::MySqlClient)
add_library(MySqlClient::MySqlClient UNKNOWN IMPORTED)
if(MYSQLCLIENT_LIBRARY_RELEASE)
set_target_properties(MySqlClient::MySqlClient PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_RELEASE}")
endif()
if(MYSQLCLIENT_LIBRARY_DEBUG)
set_target_properties(MySqlClient::MySqlClient PROPERTIES
IMPORTED_CONFIGURATIONS DEBUG
IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_DEBUG}")
endif()
set_target_properties(MySqlClient::MySqlClient PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MYSQLCLIENT_INCLUDE_DIR}"
INTERFACE_COMPILE_DEFINITIONS HAS_MYSQL=1)
endif()
endif()
mark_as_advanced(MYSQLCLIENT_INCLUDE_DIR MYSQLCLIENT_LIBRARY)
|