From 510d0e27c43cbe7d6fdad5dcd1f283fdf48c27d1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 14 Jun 2017 11:03:59 -0400 Subject: [PATCH] use FindMySQL to do a better job of finding it. --- CMakeLists.txt | 34 ++++++++++++++++++++-------------- src/zm_db.h | 2 +- src/zm_event.h | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dc28e921..2695fd352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/zm_db.h b/src/zm_db.h index 4cadcf587..a92b50eb9 100644 --- a/src/zm_db.h +++ b/src/zm_db.h @@ -20,7 +20,7 @@ #ifndef ZM_DB_H #define ZM_DB_H -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/zm_event.h b/src/zm_event.h index d6dd154fa..24c10d70d 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include