forked from hpcc-systems/HPCC-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindMYSQL.cmake
72 lines (66 loc) · 2.79 KB
/
FindMYSQL.cmake
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
70
71
72
################################################################################
# HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
# - Try to find the MYSQL library
# Once done this will define
#
# MYSQL_FOUND - system has the MYSQL library
# MYSQL_INCLUDE_DIR - the MYSQL include directory
# MYSQL_LIBRARIES - The libraries needed to use MYSQL
IF (NOT MYSQL_FOUND)
IF (WIN32)
SET (mysql_lib "libmysql")
ELSE()
SET (mysql_lib "mysqlclient_r") # Use the re-entrant version if it exists
SET (mysql_lib_alt "mysqlclient") # (but newer versions do not make the distinction and supply just the one)
ENDIF()
IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
IF (UNIX)
IF (${ARCH64BIT} EQUAL 1)
SET (osdir "linux64_gcc4.1.1")
ELSE()
SET (osdir "linux32_gcc4.1.1")
ENDIF()
ELSEIF(WIN32)
IF (${ARCH64BIT} EQUAL 1)
SET (osdir "win64")
ELSE()
SET (osdir "win32")
ENDIF()
ELSE()
SET (osdir "unknown")
ENDIF()
IF (NOT ("${osdir}" STREQUAL "unknown"))
FIND_PATH (MYSQL_INCLUDE_DIR NAMES mysql.h PATHS "${EXTERNALS_DIRECTORY}/mysql/${osdir}/include"
"${EXTERNALS_DIRECTORY}/mysql/include" NO_DEFAULT_PATH)
FIND_LIBRARY (MYSQL_LIBRARIES NAMES ${mysql_lib} PATHS "${EXTERNALS_DIRECTORY}/mysql/${osdir}/lib"
"${EXTERNALS_DIRECTORY}/mysql/${osdir}" "${EXTERNALS_DIRECTORY}/mysql/lib" NO_DEFAULT_PATH)
FIND_LIBRARY (MYSQL_LIBRARIES NAMES ${mysql_lib_alt} PATHS "${EXTERNALS_DIRECTORY}/mysql/${osdir}/lib"
"${EXTERNALS_DIRECTORY}/mysql/${osdir}" "${EXTERNALS_DIRECTORY}/mysql/lib" NO_DEFAULT_PATH)
ENDIF()
ENDIF()
if (USE_NATIVE_LIBRARIES)
# if we didn't find in externals, look in system include path
FIND_PATH (MYSQL_INCLUDE_DIR NAMES mysql.h PATH_SUFFIXES mysql)
FIND_LIBRARY (MYSQL_LIBRARIES NAMES ${mysql_lib} PATH_SUFFIXES mysql)
FIND_LIBRARY (MYSQL_LIBRARIES NAMES ${mysql_lib_alt} PATH_SUFFIXES mysql)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MYSQL DEFAULT_MSG
MYSQL_LIBRARIES
MYSQL_INCLUDE_DIR
)
MARK_AS_ADVANCED(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES)
ENDIF()