about summary refs log tree commit diff stats
path: root/cmake/modules
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-03-09 09:41:26 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-03-09 09:41:26 -0500
commitcab67a591f5cc463cdf852dc9d6a7a17e7349254 (patch)
tree09424ed4feb12559e7147ee004dd81550a1e0959 /cmake/modules
parentbdd0f853177dce9e67c3268bec0b77094ef30fa6 (diff)
downloadnancy-cab67a591f5cc463cdf852dc9d6a7a17e7349254.tar.gz
nancy-cab67a591f5cc463cdf852dc9d6a7a17e7349254.tar.bz2
nancy-cab67a591f5cc463cdf852dc9d6a7a17e7349254.zip
Added cmake Mysql finder
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindMysql.cmake78
1 files changed, 78 insertions, 0 deletions
diff --git a/cmake/modules/FindMysql.cmake b/cmake/modules/FindMysql.cmake new file mode 100644 index 0000000..e060e49 --- /dev/null +++ b/cmake/modules/FindMysql.cmake
@@ -0,0 +1,78 @@
1# This line added for distribution with Vermont:
2MESSAGE(STATUS "Using bundled FindMySQL.cmake...")
3
4# - Find MySQL
5# Find the MySQL includes and client library
6# This module defines
7# MYSQL_INCLUDE_DIR, where to find mysql.h
8# MYSQL_LIBRARIES, the libraries needed to use MySQL.
9# MYSQL_FOUND, If false, do not try to use MySQL.
10#
11# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
12#
13# Redistribution and use is allowed according to the terms of the BSD license.
14# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15
16
17IF(UNIX)
18 SET(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
19 "preferred path to MySQL (mysql_config)")
20 FIND_PROGRAM(MYSQL_CONFIG mysql_config
21 ${MYSQL_CONFIG_PREFER_PATH}
22 /usr/local/mysql/bin/
23 /usr/local/bin/
24 /usr/bin/
25 )
26
27 IF (MYSQL_CONFIG)
28 # set INCLUDE_DIR
29 EXEC_PROGRAM(${MYSQL_CONFIG}
30 ARGS --include
31 OUTPUT_VARIABLE MY_TMP)
32 string (REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}")
33 SET(MYSQL_ADD_INCLUDE_DIR ${MY_TMP} CACHE FILEPATH INTERNAL)
34
35 # set LIBRARY_DIR
36 EXEC_PROGRAM(${MYSQL_CONFIG}
37 ARGS --libs
38 OUTPUT_VARIABLE MY_TMP)
39 string (REGEX REPLACE "(.* )?-L([^ ]*)( .*)?" "\\2" MY_TMP "${MY_TMP}")
40 SET(MYSQL_ADD_LIBRARY ${MY_TMP} CACHE FILEPATH INTERNAL)
41 ENDIF(MYSQL_CONFIG)
42
43ELSE(UNIX)
44 set(MYSQL_ADD_INCLUDE_DIR "c:/msys/local/include" CACHE FILEPATH INTERNAL)
45 set(MYSQL_ADD_LIBRARY "c:/msys/local/lib" CACHE FILEPATH INTERNAL)
46ENDIF(UNIX)
47
48if (NOT MYSQL_FOUND)
49
50 find_path(MYSQL_INCLUDE_DIR mysql.h
51 /usr/local/include
52 /usr/local/include/mysql
53 /usr/local/mysql/include
54 /usr/include
55 ${MYSQL_ADD_INCLUDE_DIR}
56 )
57
58 find_library(MYSQL_LIBRARIES NAMES mysqlclient
59 PATHS
60 /usr/lib
61 /usr/lib/mysql
62 /usr/local/lib
63 /usr/local/lib/mysql
64 /usr/local/mysql/lib
65 ${MYSQL_ADD_LIBRARY}
66 )
67
68 if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
69 set(MYSQL_FOUND TRUE CACHE INTERNAL "MySQL found")
70 message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
71 else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
72 set(MYSQL_FOUND FALSE CACHE INTERNAL "MySQL found")
73 message(STATUS "MySQL not found.")
74 endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
75
76 mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES)
77
78endif (NOT MYSQL_FOUND) \ No newline at end of file