use FindMySQL to do a better job of finding it.

This commit is contained in:
Isaac Connor 2017-06-14 11:03:59 -04:00
parent b9eee3230e
commit 510d0e27c4
3 changed files with 22 additions and 16 deletions

View File

@ -93,6 +93,7 @@ include (CheckPrototypeDefinition_fixed)
include (CheckTypeSize)
include (CheckStructHasMember)
include (CheckSendfile)
include (FindMySQL)
# Configuration options
mark_as_advanced(
@ -348,10 +349,18 @@ if(PCRE_LIBRARIES)
find_path(PCRE_INCLUDE_DIR pcre.h)
if(PCRE_INCLUDE_DIR)
include_directories("${PCRE_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}" )
else(PCRE_INCLUDE_DIR)
message(FATAL_ERROR
"ZoneMinder requires pcre headers - unable to find pcre.h. check that pcre development packages are installed")
endif(PCRE_INCLUDE_DIR)
mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR)
check_include_file("pcre.h" HAVE_PCRE_H)
if(NOT HAVE_PCRE_H)
#message(FATAL_ERROR
#"ZoneMinder requires pcre headers - check that pcre development packages are installed")
endif(NOT HAVE_PCRE_H)
set(optlibsfound "${optlibsfound} PCRE")
else(PCRE_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} PCRE")
@ -397,25 +406,22 @@ else(GNUTLS_LIBRARIES)
endif(GNUTLS_LIBRARIES)
# mysqlclient (using find_library and find_path)
find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
if(MYSQLCLIENT_LIBRARIES)
if(MYSQL_LIBRARIES)
set(HAVE_LIBMYSQLCLIENT 1)
list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}")
find_path(MYSQLCLIENT_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql)
if(MYSQLCLIENT_INCLUDE_DIR)
include_directories("${MYSQLCLIENT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${MYSQLCLIENT_INCLUDE_DIR}")
endif(MYSQLCLIENT_INCLUDE_DIR)
mark_as_advanced(FORCE MYSQLCLIENT_LIBRARIES MYSQLCLIENT_INCLUDE_DIR)
list(APPEND ZM_BIN_LIBS "${MYSQL_LIBRARIES}")
if(MYSQL_INCLUDE_DIR)
include_directories("${MYSQL_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${MYSQL_INCLUDE_DIR}")
endif(MYSQL_INCLUDE_DIR)
check_include_file("mysql.h" HAVE_MYSQL_H)
if(NOT HAVE_MYSQL_H)
if(NOT MYSQL_VERSION)
message(FATAL_ERROR
"ZoneMinder requires MySQL headers - check that MySQL development packages are installed")
endif(NOT HAVE_MYSQL_H)
else(MYSQLCLIENT_LIBRARIES)
endif(NOT MYSQL_VERSION)
else(MYSQL_LIBRARIES)
message(FATAL_ERROR
"ZoneMinder requires mysqlclient but it was not found on your system")
endif(MYSQLCLIENT_LIBRARIES)
endif(MYSQL_LIBRARIES)
# x264 (using find_library and find_path)
find_library(X264_LIBRARIES x264)

View File

@ -20,7 +20,7 @@
#ifndef ZM_DB_H
#define ZM_DB_H
#include <mysql/mysql.h>
#include <mysql.h>
#ifdef __cplusplus
extern "C" {

View File

@ -29,7 +29,7 @@
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <mysql/mysql.h>
#include <mysql.h>
#include <set>
#include <map>