Clean up CMakeLists.txt, wrap lines, remove comments from initial commit, update comments. No functionality changes
This commit is contained in:
parent
c17d156d95
commit
14cf1bcae6
214
CMakeLists.txt
214
CMakeLists.txt
|
@ -1,25 +1,28 @@
|
|||
# Main CMake file for the ZoneMinder project.
|
||||
# Created by mastertheknife (Kfir Itzhak)
|
||||
# The goal is to ease up the installation of zoneminder.
|
||||
# Our current installation method (using autotools) is outdated, slow and breaks now and then.
|
||||
# The CMake installation method will require no parameters at all, default should sufficient and reliable.
|
||||
# It will be still possible to install ZoneMinder using autotools, they don't conflict with each other. The cmake way is a complete re-write (different syntax) and aims to be identical to the autotools way,
|
||||
# by having options using the same name and leaving ZM totally unmodified, while providing exactly the same things that ZM expects (config.h, configuration in *.in files, etc).
|
||||
#
|
||||
# For more information and installation, see the INSTALL file
|
||||
#
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
project (zoneminder)
|
||||
set(zoneminder_VERSION "1.28.1")
|
||||
|
||||
# CMake does not allow out-of-source build if CMakeCache.exists in the source folder. Abort and notify the user to save him from headache why it doesn't work.
|
||||
if((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
|
||||
message(FATAL_ERROR " You are attempting to do an out-of-source build, but a cmake cache file for an in-source build exists. Please delete the file CMakeCache.txt from the source folder to proceed.")
|
||||
endif((NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
|
||||
# CMake does not allow out-of-source build if CMakeCache.exists
|
||||
# in the source folder. Abort and notify the user
|
||||
if(
|
||||
(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
|
||||
message(FATAL_ERROR " You are attempting to do an out-of-source build,
|
||||
but a cmake cache file for an in-source build exists. Please delete
|
||||
the file CMakeCache.txt from the source folder to proceed.")
|
||||
endif(
|
||||
(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
AND (EXISTS "${CMAKE_SOURCE_DIR}/CMakeCache.txt"))
|
||||
|
||||
# Default build type. To change the build type, use the CMAKE_BUILD_TYPE configuration option.
|
||||
# Default build type. To change the build type,
|
||||
# use the CMAKE_BUILD_TYPE configuration option.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Release or Debug" FORCE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
Release CACHE STRING "Build type: Release or Debug" FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# Can assist in troubleshooting
|
||||
|
@ -44,33 +47,74 @@ include (CheckTypeSize)
|
|||
include (CheckStructHasMember)
|
||||
|
||||
# Configuration options
|
||||
mark_as_advanced(FORCE ZM_EXTRA_LIBS ZM_MYSQL_ENGINE ZM_NO_MMAP CMAKE_INSTALL_FULL_BINDIR ZM_PERL_SUBPREFIX ZM_PERL_USE_PATH ZM_TARGET_DISTRO ZM_CONFIG_DIR)
|
||||
set(ZM_RUNDIR "/var/run/zm" CACHE PATH "Location of transient process files, default: /var/run/zm")
|
||||
set(ZM_SOCKDIR "/var/run/zm" CACHE PATH "Location of Unix domain socket files, default /var/run/zm")
|
||||
set(ZM_TMPDIR "/var/tmp/zm" CACHE PATH "Location of temporary files, default: /tmp/zm")
|
||||
set(ZM_LOGDIR "/var/log/zm" CACHE PATH "Location of generated log files, default: /var/log/zm")
|
||||
set(ZM_WEBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder/www" CACHE PATH "Location of the web files, default: <prefix>/${CMAKE_INSTALL_DATADIR}/zoneminder/www")
|
||||
set(ZM_CGIDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin" CACHE PATH "Location of the cgi-bin files, default: <prefix>/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin")
|
||||
set(ZM_CONTENTDIR "/var/lib/zoneminder" CACHE PATH "Location of dynamic content (events and images), default: /var/lib/zoneminder")
|
||||
set(ZM_DB_HOST "localhost" CACHE STRING "Hostname where ZoneMinder database located, default: localhost")
|
||||
set(ZM_DB_NAME "zm" CACHE STRING "Name of ZoneMinder database, default: zm")
|
||||
set(ZM_DB_USER "zmuser" CACHE STRING "Name of ZoneMinder database user, default: zmuser")
|
||||
set(ZM_DB_PASS "zmpass" CACHE STRING "Password of ZoneMinder database user, default: zmpass")
|
||||
set(ZM_WEB_USER "" CACHE STRING "The user apache or the local web server runs on. Leave empty for automatic detection. If that fails, you can use this variable to force")
|
||||
set(ZM_WEB_GROUP "" CACHE STRING "The group apache or the local web server runs on, Leave empty to be the same as the web user")
|
||||
mark_as_advanced(
|
||||
FORCE ZM_EXTRA_LIBS
|
||||
ZM_MYSQL_ENGINE
|
||||
ZM_NO_MMAP
|
||||
CMAKE_INSTALL_FULL_BINDIR
|
||||
ZM_PERL_SUBPREFIX
|
||||
ZM_PERL_USE_PATH
|
||||
ZM_TARGET_DISTRO
|
||||
ZM_CONFIG_DIR)
|
||||
|
||||
set(ZM_RUNDIR "/var/run/zm" CACHE PATH
|
||||
"Location of transient process files, default: /var/run/zm")
|
||||
set(ZM_SOCKDIR "/var/run/zm" CACHE PATH
|
||||
"Location of Unix domain socket files, default /var/run/zm")
|
||||
set(ZM_TMPDIR "/var/tmp/zm" CACHE PATH
|
||||
"Location of temporary files, default: /tmp/zm")
|
||||
set(ZM_LOGDIR "/var/log/zm" CACHE PATH
|
||||
"Location of generated log files, default: /var/log/zm")
|
||||
set(ZM_WEBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder/www" CACHE PATH
|
||||
"Location of the web files, default: <prefix>/${CMAKE_INSTALL_DATADIR}/zoneminder/www")
|
||||
set(ZM_CGIDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin" CACHE PATH
|
||||
"Location of the cgi-bin files, default: <prefix>/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin")
|
||||
set(ZM_CONTENTDIR "/var/lib/zoneminder" CACHE PATH
|
||||
"Location of dynamic content (events and images), default: /var/lib/zoneminder")
|
||||
set(ZM_DB_HOST "localhost" CACHE STRING
|
||||
"Hostname where ZoneMinder database located, default: localhost")
|
||||
set(ZM_DB_NAME "zm" CACHE STRING
|
||||
"Name of ZoneMinder database, default: zm")
|
||||
set(ZM_DB_USER "zmuser" CACHE STRING
|
||||
"Name of ZoneMinder database user, default: zmuser")
|
||||
set(ZM_DB_PASS "zmpass" CACHE STRING
|
||||
"Password of ZoneMinder database user, default: zmpass")
|
||||
set(ZM_WEB_USER "" CACHE STRING
|
||||
"The user apache or the local web server runs on. Leave empty for automatic detection.
|
||||
If that fails, you can use this variable to force")
|
||||
set(ZM_WEB_GROUP "" CACHE STRING
|
||||
"The group apache or the local web server runs on,
|
||||
Leave empty to be the same as the web user")
|
||||
# Advanced
|
||||
set(ZM_CONFIG_DIR "/${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH "Location of ZoneMinder configuration, default system config directory")
|
||||
set(ZM_EXTRA_LIBS "" CACHE STRING "A list of optional libraries, separated by semicolons, e.g. ssl;theora")
|
||||
set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING "MySQL engine to use with database, default: InnoDB")
|
||||
set(ZM_NO_MMAP "OFF" CACHE BOOL "Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF")
|
||||
set(ZM_NO_FFMPEG "OFF" CACHE BOOL "Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF")
|
||||
set(ZM_NO_LIBVLC "OFF" CACHE BOOL "Set to ON to skip libvlc checks and force building ZM without libvlc. default: OFF")
|
||||
set(ZM_NO_CURL "OFF" CACHE BOOL "Set to ON to skip cURL checks and force building ZM without cURL. default: OFF")
|
||||
set(ZM_NO_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 support. default: OFF")
|
||||
set(ZM_ONVIF "OFF" CACHE BOOL "Set to ON to enable basic ONVIF support. This is EXPERIMENTAL and may not work with all cameras claiming to be ONVIF compliant. default: OFF")
|
||||
set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into <prefix>/lib, default: <libdir>/perl5")
|
||||
set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: <prefix>/<zmperlsubprefix>")
|
||||
set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f21, f20, el6, OS13")
|
||||
set(ZM_CONFIG_DIR "/${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH
|
||||
"Location of ZoneMinder configuration, default system config directory")
|
||||
set(ZM_EXTRA_LIBS "" CACHE STRING
|
||||
"A list of optional libraries, separated by semicolons, e.g. ssl;theora")
|
||||
set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING
|
||||
"MySQL engine to use with database, default: InnoDB")
|
||||
set(ZM_NO_MMAP "OFF" CACHE BOOL
|
||||
"Set to ON to not use mmap shared memory. Shouldn't be enabled unless you
|
||||
experience problems with the shared memory. default: OFF")
|
||||
set(ZM_NO_FFMPEG "OFF" CACHE BOOL
|
||||
"Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF")
|
||||
set(ZM_NO_LIBVLC "OFF" CACHE BOOL
|
||||
"Set to ON to skip libvlc checks and force building ZM without libvlc. default: OFF")
|
||||
set(ZM_NO_CURL "OFF" CACHE BOOL
|
||||
"Set to ON to skip cURL checks and force building ZM without cURL. default: OFF")
|
||||
set(ZM_NO_X10 "OFF" CACHE BOOL
|
||||
"Set to ON to build ZoneMinder without X10 support. default: OFF")
|
||||
set(ZM_ONVIF "OFF" CACHE BOOL
|
||||
"Set to ON to enable basic ONVIF support. This is EXPERIMENTAL and may not
|
||||
work with all cameras claiming to be ONVIF compliant. default: OFF")
|
||||
set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH
|
||||
"Use a different directory for the zm perl modules.
|
||||
NOTE: This is a subprefix, e.g. lib will be turned into <prefix>/lib,
|
||||
default: <libdir>/perl5")
|
||||
set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH
|
||||
"Override the include path for zm perl modules. Useful if you are moving the
|
||||
perl modules without using the ZM_PERL_SUBPREFIX option. default: <prefix>/<zmperlsubprefix>")
|
||||
set(ZM_TARGET_DISTRO "" CACHE STRING
|
||||
"Build ZoneMinder for a specific distribution. Currently, valid names are: f21, f20, el6, OS13")
|
||||
|
||||
# Reassign some variables if a target distro has been specified
|
||||
if((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f20"))
|
||||
|
@ -105,7 +149,9 @@ elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
|
|||
endif((ZM_TARGET_DISTRO STREQUAL "f21") OR (ZM_TARGET_DISTRO STREQUAL "f20"))
|
||||
|
||||
# Required for certain checks to work
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES
|
||||
${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h
|
||||
)
|
||||
# Required for including headers from the this folder
|
||||
include_directories("${CMAKE_BINARY_DIR}")
|
||||
# This is required to enable searching in lib64 (if exists), do not change
|
||||
|
@ -170,10 +216,12 @@ if(JPEG_FOUND)
|
|||
set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}")
|
||||
check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
|
||||
if(NOT HAVE_JPEGLIB_H)
|
||||
message(FATAL_ERROR " zm requires libjpeg headers - check that libjpeg development packages are installed")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires libjpeg headers - check that libjpeg development packages are installed")
|
||||
endif(NOT HAVE_JPEGLIB_H)
|
||||
else(JPEG_FOUND)
|
||||
message(FATAL_ERROR "zm requires jpeg but it was not found on your system")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires jpeg but it was not found on your system")
|
||||
endif(JPEG_FOUND)
|
||||
|
||||
# OpenSSL
|
||||
|
@ -203,10 +251,12 @@ if(PTHREAD_LIBRARIES)
|
|||
mark_as_advanced(FORCE PTHREAD_LIBRARIES PTHREAD_INCLUDE_DIR)
|
||||
check_include_file("pthread.h" HAVE_PTHREAD_H)
|
||||
if(NOT HAVE_PTHREAD_H)
|
||||
message(FATAL_ERROR " zm requires pthread headers - check that pthread development packages are installed")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires pthread headers - check that pthread development packages are installed")
|
||||
endif(NOT HAVE_PTHREAD_H)
|
||||
else(PTHREAD_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires pthread but it was not found on your system")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires pthread but it was not found on your system")
|
||||
endif(PTHREAD_LIBRARIES)
|
||||
|
||||
# pcre (using find_library and find_path)
|
||||
|
@ -278,10 +328,12 @@ if(MYSQLCLIENT_LIBRARIES)
|
|||
mark_as_advanced(FORCE MYSQLCLIENT_LIBRARIES MYSQLCLIENT_INCLUDE_DIR)
|
||||
check_include_file("mysql/mysql.h" HAVE_MYSQL_H)
|
||||
if(NOT HAVE_MYSQL_H)
|
||||
message(FATAL_ERROR "zm requires MySQL headers - check that MySQL development packages are installed")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires MySQL headers - check that MySQL development packages are installed")
|
||||
endif(NOT HAVE_MYSQL_H)
|
||||
else(MYSQLCLIENT_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires mysqlclient but it was not found on your system")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires mysqlclient but it was not found on your system")
|
||||
endif(MYSQLCLIENT_LIBRARIES)
|
||||
|
||||
set(PATH_FFMPEG "")
|
||||
|
@ -408,7 +460,8 @@ endif(NOT ZM_NO_LIBVLC)
|
|||
|
||||
# Check for gnutls or crypto
|
||||
if((NOT HAVE_LIBCRYPTO) AND (NOT HAVE_LIBGNUTLS))
|
||||
message(FATAL_ERROR " zm requires crypto or gnutls but none were found on your system")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires crypto or gnutls but none were found on your system")
|
||||
endif((NOT HAVE_LIBCRYPTO) AND (NOT HAVE_LIBGNUTLS))
|
||||
|
||||
# Check for V4L header files and enable ZM_HAS_V4L, ZM_HAS_V4L1, ZM_HAS_V4L2 accordingly
|
||||
|
@ -424,9 +477,14 @@ if(HAVE_LINUX_VIDEODEV2_H)
|
|||
set(ZM_HAS_V4L 1)
|
||||
set(ZM_HAS_V4L2 1)
|
||||
endif(HAVE_LINUX_VIDEODEV2_H)
|
||||
if((NOT HAVE_LINUX_VIDEODEV_H) AND (NOT HAVE_LIBV4L1_VIDEODEV_H) AND (NOT HAVE_LINUX_VIDEODEV2_H))
|
||||
message(AUTHOR_WARNING " Video 4 Linux headers weren't found - Analog and USB camera support will not be available")
|
||||
endif((NOT HAVE_LINUX_VIDEODEV_H) AND (NOT HAVE_LIBV4L1_VIDEODEV_H) AND (NOT HAVE_LINUX_VIDEODEV2_H))
|
||||
if((NOT HAVE_LINUX_VIDEODEV_H)
|
||||
AND (NOT HAVE_LIBV4L1_VIDEODEV_H)
|
||||
AND (NOT HAVE_LINUX_VIDEODEV2_H))
|
||||
message(AUTHOR_WARNING
|
||||
"Video 4 Linux headers weren't found - Analog and USB camera support will not be available")
|
||||
endif((NOT HAVE_LINUX_VIDEODEV_H)
|
||||
AND (NOT HAVE_LIBV4L1_VIDEODEV_H)
|
||||
AND (NOT HAVE_LINUX_VIDEODEV2_H))
|
||||
# Check for PCRE and enable ZM_PCRE accordingly
|
||||
set(ZM_PCRE 0)
|
||||
if(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
||||
|
@ -447,26 +505,37 @@ if(ZM_ONVIF)
|
|||
set(ZM_HAS_ONVIF 1)
|
||||
endif(ZM_ONVIF)
|
||||
|
||||
# Check for authenication functions
|
||||
# Check for authentication functions
|
||||
if(HAVE_OPENSSL_MD5_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
|
||||
check_prototype_definition(MD5 "unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)" "NULL" "openssl/md5.h" HAVE_MD5_OPENSSL)
|
||||
check_prototype_definition(
|
||||
MD5
|
||||
"unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)" "NULL" "openssl/md5.h"
|
||||
HAVE_MD5_OPENSSL)
|
||||
endif(HAVE_OPENSSL_MD5_H)
|
||||
if(HAVE_GNUTLS_OPENSSL_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
|
||||
check_prototype_definition(MD5 "unsigned char *MD5 (const unsigned char *buf, unsigned long len, unsigned char *md)" "NULL" "gnutls/openssl.h" HAVE_MD5_GNUTLS)
|
||||
check_prototype_definition(
|
||||
MD5
|
||||
"unsigned char *MD5 (const unsigned char *buf, unsigned long len, unsigned char *md)" "NULL" "gnutls/openssl.h"
|
||||
HAVE_MD5_GNUTLS)
|
||||
endif(HAVE_GNUTLS_OPENSSL_H)
|
||||
if(HAVE_GNUTLS_GNUTLS_H)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
|
||||
check_prototype_definition(gnutls_fingerprint "int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void *result, size_t * result_size)" "0" "stdlib.h;gnutls/gnutls.h" HAVE_DECL_GNUTLS_FINGERPRINT)
|
||||
check_prototype_definition(
|
||||
gnutls_fingerprint
|
||||
"int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void *result, size_t * result_size)" "0" "stdlib.h;gnutls/gnutls.h"
|
||||
HAVE_DECL_GNUTLS_FINGERPRINT)
|
||||
endif(HAVE_GNUTLS_GNUTLS_H)
|
||||
if(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
set(HAVE_DECL_MD5 1)
|
||||
else(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
message(AUTHOR_WARNING " ZM requires a working MD5 function for hashed authenication but none were found - hashed authenication will not be available")
|
||||
message(AUTHOR_WARNING
|
||||
"ZoneMinder requires a working MD5 function for hashed authenication but
|
||||
none were found - hashed authenication will not be available")
|
||||
endif(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
# Dirty fix for zm_user only using openssl's md5 if gnutls and gcrypt are not available.
|
||||
# This needs to be fixed in zm_user.[h,cpp] but such fix will also require changes to configure.ac
|
||||
|
@ -478,26 +547,40 @@ endif(HAVE_LIBCRYPTO AND HAVE_OPENSSL_MD5_H AND HAVE_MD5_OPENSSL)
|
|||
# Check for Perl
|
||||
find_package(Perl)
|
||||
if(NOT PERL_FOUND)
|
||||
message(FATAL_ERROR "zm requires Perl 5.6.0 or newer but it was not found on your system")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder requires Perl 5.6.0 or newer but it was not found on your system")
|
||||
endif(NOT PERL_FOUND)
|
||||
|
||||
# Checking for perl modules requires FindPerlModules.cmake
|
||||
# Check all required modules at once
|
||||
# TODO: Add checking for the optional modules
|
||||
find_package(PerlModules COMPONENTS Sys::Syslog DBI DBD::mysql Getopt::Long Time::HiRes Date::Manip LWP::UserAgent ExtUtils::MakeMaker ${ZM_MMAP_PERLPACKAGE})
|
||||
find_package(
|
||||
PerlModules COMPONENTS Sys::Syslog DBI DBD::mysql
|
||||
Getopt::Long Time::HiRes Date::Manip LWP::UserAgent
|
||||
ExtUtils::MakeMaker ${ZM_MMAP_PERLPACKAGE})
|
||||
if(NOT PERLMODULES_FOUND)
|
||||
message(FATAL_ERROR "Not all required perl modules were found on your system")
|
||||
message(FATAL_ERROR
|
||||
"Not all required perl modules were found on your system")
|
||||
endif(NOT PERLMODULES_FOUND)
|
||||
|
||||
# Attempt to check which user apache (or other web server) runs on by searching for a user beginning with apache or www and then cutting the user from the first matching user line
|
||||
# Attempt to check which user apache (or other web server) runs on by
|
||||
# searching for a user beginning with apache or www and then cutting the user
|
||||
# from the first matching user line
|
||||
if(ZM_WEB_USER STREQUAL "")
|
||||
# Check for a user matching ^apache and cut the username from the userline in the first match
|
||||
# Check for a user matching ^apache and cut the username from the
|
||||
# userline in the first match
|
||||
file(STRINGS "/etc/passwd" userline_apache REGEX "^apache")
|
||||
file(STRINGS "/etc/passwd" userline_www REGEX "^www")
|
||||
if(NOT (userline_apache STREQUAL ""))
|
||||
execute_process(COMMAND echo ${userline_apache} COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND echo ${userline_apache}
|
||||
COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
elseif(NOT (userline_www STREQUAL ""))
|
||||
execute_process(COMMAND echo ${userline_www} COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND echo ${userline_www}
|
||||
COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif(NOT (userline_apache STREQUAL ""))
|
||||
message(STATUS "Detected web server user: ${ZM_WEB_USER}")
|
||||
endif(ZM_WEB_USER STREQUAL "")
|
||||
|
@ -511,7 +594,8 @@ message(STATUS "Using web group: ${ZM_WEB_GROUP}")
|
|||
# Check for polkit
|
||||
find_package(Polkit)
|
||||
if(NOT POLKIT_FOUND)
|
||||
message(FATAL_ERROR "Running ZoneMinder requires polkit. Building ZoneMinder requires the polkit development package.")
|
||||
message(FATAL_ERROR
|
||||
"Running ZoneMinder requires polkit. Building ZoneMinder requires the polkit development package.")
|
||||
endif(NOT POLKIT_FOUND)
|
||||
|
||||
# Some variables that zm expects
|
||||
|
@ -564,9 +648,11 @@ message(STATUS "Optional libraries not found:${optlibsnotfound}")
|
|||
message(STATUS "Running ZoneMinder configuration generator")
|
||||
execute_process(COMMAND perl ./zmconfgen.pl RESULT_VARIABLE zmconfgen_result)
|
||||
if(zmconfgen_result EQUAL 0)
|
||||
message(STATUS "ZoneMinder configuration generator completed successfully")
|
||||
message(STATUS
|
||||
"ZoneMinder configuration generator completed successfully")
|
||||
else(zmconfgen_result EQUAL 0)
|
||||
message(FATAL_ERROR "ZoneMinder configuration generator failed. Exit code: ${zmconfgen_result}")
|
||||
message(FATAL_ERROR
|
||||
"ZoneMinder configuration generator failed. Exit code: ${zmconfgen_result}")
|
||||
endif(zmconfgen_result EQUAL 0)
|
||||
|
||||
# Install zm.conf
|
||||
|
|
Loading…
Reference in New Issue