2013-09-28 17:59:50 +08:00
|
|
|
# Main CMake file for the ZoneMinder project.
|
|
|
|
# Created by mastertheknife (Kfir Itzhak)
|
|
|
|
# For more information and installation, see the INSTALL file
|
|
|
|
#
|
2021-02-09 20:12:19 +08:00
|
|
|
cmake_minimum_required(VERSION 3.5.0)
|
2013-10-09 20:41:14 +08:00
|
|
|
project(zoneminder)
|
2016-06-03 21:51:50 +08:00
|
|
|
file(STRINGS "version" zoneminder_VERSION)
|
2015-06-14 00:30:28 +08:00
|
|
|
# make API version a minor of ZM version
|
|
|
|
set(zoneminder_API_VERSION "${zoneminder_VERSION}.1")
|
2013-10-09 20:41:14 +08:00
|
|
|
|
2015-11-22 08:21:18 +08:00
|
|
|
# Make sure the submodules are there
|
2015-12-05 02:03:18 +08:00
|
|
|
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/web/api/app/Plugin/Crud/Lib/CrudControllerTrait.php")
|
2015-11-22 08:21:18 +08:00
|
|
|
message(SEND_ERROR "The git submodules are not available. Please run git submodule update --init --recursive")
|
2015-12-05 02:03:18 +08:00
|
|
|
endif()
|
2015-11-22 08:21:18 +08:00
|
|
|
|
2015-04-15 20:09:25 +08:00
|
|
|
# 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()
|
|
|
|
|
|
|
|
# Default build type. To change the build type,
|
|
|
|
# use the CMAKE_BUILD_TYPE configuration option.
|
2013-09-28 17:59:50 +08:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2015-04-15 20:09:25 +08:00
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Release or Debug" FORCE)
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2013-10-09 20:41:14 +08:00
|
|
|
# Can assist in troubleshooting
|
2013-09-28 17:59:50 +08:00
|
|
|
#set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
|
|
#set(CMAKE_INSTALL_ALWAYS ON)
|
|
|
|
|
|
|
|
# Default CLFAGS and CXXFLAGS:
|
2021-02-09 05:54:40 +08:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
|
|
|
set(CMAKE_C_FLAGS_OPTIMISED "-O3")
|
|
|
|
set(CMAKE_CXX_FLAGS_OPTIMISED "-O3")
|
2013-09-28 17:59:50 +08:00
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
2017-12-04 00:09:01 +08:00
|
|
|
|
2021-02-09 05:22:38 +08:00
|
|
|
include(ConfigureBaseTargets)
|
2021-02-09 04:46:38 +08:00
|
|
|
include(CheckPlatform)
|
2013-10-09 20:41:14 +08:00
|
|
|
|
2017-03-26 02:49:15 +08:00
|
|
|
# GCC below 6.0 doesn't support __target__("fpu=neon") attribute, required for compiling ARM Neon code, otherwise compilation fails.
|
|
|
|
# Must use -mfpu=neon compiler flag instead, but only do that for processors that support neon, otherwise strip the neon code alltogether,
|
|
|
|
# because passing -fmpu=neon is unsafe to processors that don't support neon
|
2017-08-22 00:02:28 +08:00
|
|
|
|
|
|
|
# Arm neon support only tested on Linux. If your arm hardware is running a non-Linux distro and is using gcc then contact us.
|
2021-02-09 04:46:38 +08:00
|
|
|
if(ZM_SYSTEM_PROC MATCHES "^arm")
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
|
|
|
exec_program(grep ARGS " neon " "/proc/cpuinfo" OUTPUT_VARIABLE neonoutput RETURN_VALUE neonresult)
|
|
|
|
if(neonresult EQUAL 0)
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfpu=neon")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpu=neon")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mfpu=neon")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon")
|
|
|
|
else()
|
|
|
|
add_definitions(-DZM_STRIP_NEON=1)
|
|
|
|
message(STATUS "ARM Neon is not available on this processor. Neon functions will be absent")
|
2017-08-22 00:02:28 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-03-25 01:41:10 +08:00
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Modules that we need:
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckTypeSize)
|
2015-04-01 11:07:19 +08:00
|
|
|
include(CheckSendfile)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2013-10-09 20:41:14 +08:00
|
|
|
# Configuration options
|
2015-04-15 20:09:25 +08:00
|
|
|
mark_as_advanced(
|
|
|
|
FORCE ZM_EXTRA_LIBS
|
|
|
|
ZM_MYSQL_ENGINE
|
|
|
|
ZM_NO_MMAP
|
|
|
|
CMAKE_INSTALL_FULL_BINDIR
|
2015-05-19 19:12:34 +08:00
|
|
|
ZM_PERL_MM_PARMS
|
|
|
|
ZM_PERL_SEARCH_PATH
|
2015-04-15 20:09:25 +08:00
|
|
|
ZM_TARGET_DISTRO
|
2017-06-13 09:39:37 +08:00
|
|
|
ZM_PATH_MAP
|
|
|
|
ZM_PATH_ARP
|
2017-02-05 05:34:57 +08:00
|
|
|
ZM_CONFIG_DIR
|
2017-06-06 04:39:19 +08:00
|
|
|
ZM_CONFIG_SUBDIR
|
2018-12-07 23:47:00 +08:00
|
|
|
ZM_SYSTEMD
|
|
|
|
ZM_MANPAGE_DEST_PREFIX)
|
2015-04-15 20:09:25 +08:00
|
|
|
|
2021-04-30 06:13:32 +08:00
|
|
|
option(ENABLE_WERROR "Fail the build if a compiler warning is emitted" 0)
|
2021-02-03 05:57:50 +08:00
|
|
|
option(BUILD_TEST_SUITE "Build the test suite" 0)
|
2021-02-04 04:22:28 +08:00
|
|
|
option(BUILD_MAN "Build man pages" 1)
|
2021-02-09 06:07:21 +08:00
|
|
|
option(ASAN "DEBUGGING: Build with AddressSanitizer (ASan) support" 0)
|
2021-02-11 07:38:31 +08:00
|
|
|
option(TSAN "DEBUGGING: Build with ThreadSanitizer (TSan) support" 0)
|
|
|
|
|
|
|
|
if(ASAN AND TSAN)
|
|
|
|
message(FATAL_ERROR "ASAN and TSAN options are mutually exclusive")
|
|
|
|
endif()
|
2021-02-04 04:22:28 +08:00
|
|
|
|
2021-02-03 05:57:50 +08:00
|
|
|
set(ZM_RUNDIR "/var/run/zm" CACHE PATH
|
2015-04-15 20:09:25 +08:00
|
|
|
"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")
|
2020-03-03 21:41:53 +08:00
|
|
|
set(ZM_WEBDIR "${CMAKE_INSTALL_FULL_DATADIR}/zoneminder/www" CACHE PATH
|
2015-04-15 20:09:25 +08:00
|
|
|
"Location of the web files, default: <prefix>/${CMAKE_INSTALL_DATADIR}/zoneminder/www")
|
2020-03-03 21:41:53 +08:00
|
|
|
set(ZM_CGIDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/zoneminder/cgi-bin" CACHE PATH
|
2015-04-15 20:09:25 +08:00
|
|
|
"Location of the cgi-bin files, default: <prefix>/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin")
|
2018-04-20 03:01:46 +08:00
|
|
|
set(ZM_CACHEDIR "/var/cache/zoneminder" CACHE PATH
|
|
|
|
"Location of the web server cache busting files, default: /var/cache/zoneminder")
|
2015-04-15 20:09:25 +08:00
|
|
|
set(ZM_CONTENTDIR "/var/lib/zoneminder" CACHE PATH
|
|
|
|
"Location of dynamic content (events and images), default: /var/lib/zoneminder")
|
2020-12-01 22:21:25 +08:00
|
|
|
set(ZM_FONTDIR "${CMAKE_INSTALL_FULL_DATADIR}/zoneminder/fonts" CACHE PATH
|
|
|
|
"Location of the font files used for timestamping, default: <prefix>/${CMAKE_INSTALL_DATADIR}/zoneminder/fonts")
|
|
|
|
|
2015-04-15 20:09:25 +08:00
|
|
|
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")
|
2017-07-21 20:18:13 +08:00
|
|
|
set(ZM_DIR_EVENTS "${ZM_CONTENTDIR}/events" CACHE PATH
|
|
|
|
"Location where events are recorded to, default: ZM_CONTENTDIR/events")
|
2017-06-13 09:39:37 +08:00
|
|
|
set(ZM_DIR_SOUNDS "sounds" CACHE PATH
|
|
|
|
"Location to look for optional sound files, default: sounds")
|
|
|
|
set(ZM_PATH_ZMS "/cgi-bin/nph-zms" CACHE PATH
|
|
|
|
"Web url to zms streaming server, default: /cgi-bin/nph-zms")
|
2019-05-28 00:09:32 +08:00
|
|
|
set(ZM_PATH_SHUTDOWN "/sbin/shutdown" CACHE PATH
|
|
|
|
"Path to shutdown binary, default: /sbin/shutdown")
|
2017-06-13 09:39:37 +08:00
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Advanced
|
2017-06-13 09:39:37 +08:00
|
|
|
set(ZM_PATH_MAP "/dev/shm" CACHE PATH
|
|
|
|
"Location to save mapped memory files, default: /dev/shm")
|
|
|
|
set(ZM_PATH_ARP "" CACHE PATH
|
|
|
|
"Full path to compatible arp binary. Leave empty for automatic detection.")
|
2015-04-15 20:09:25 +08:00
|
|
|
set(ZM_CONFIG_DIR "/${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH
|
|
|
|
"Location of ZoneMinder configuration, default system config directory")
|
2017-09-24 01:40:43 +08:00
|
|
|
set(ZM_CONFIG_SUBDIR "${ZM_CONFIG_DIR}/conf.d" CACHE PATH
|
2017-06-06 04:39:19 +08:00
|
|
|
"Location of ZoneMinder configuration subfolder, default: ZM_CONFIG_DIR/conf.d")
|
2015-04-15 20:09:25 +08:00
|
|
|
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_LIBVLC "OFF" CACHE BOOL
|
|
|
|
"Set to ON to skip libvlc checks and force building ZM without libvlc. default: OFF")
|
2020-03-26 14:29:22 +08:00
|
|
|
set(ZM_NO_LIBVNC "OFF" CACHE BOOL
|
|
|
|
"Set to ON to skip libvnc checks and force building ZM without libvnc. default: OFF")
|
2015-04-15 20:09:25 +08:00
|
|
|
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")
|
2016-02-09 04:05:06 +08:00
|
|
|
set(ZM_ONVIF "ON" CACHE BOOL
|
2015-04-15 20:09:25 +08:00
|
|
|
"Set to ON to enable basic ONVIF support. This is EXPERIMENTAL and may not
|
2016-02-09 04:05:06 +08:00
|
|
|
work with all cameras claiming to be ONVIF compliant. default: ON")
|
2021-11-25 01:44:07 +08:00
|
|
|
set(ZM_NO_PCRE "OFF" CACHE BOOL
|
|
|
|
"Set to ON to skip libpcre3 checks and force building ZM without libpcre3. default: OFF")
|
2020-12-09 04:59:06 +08:00
|
|
|
set(ZM_NO_RTSPSERVER "OFF" CACHE BOOL
|
2021-03-11 21:07:45 +08:00
|
|
|
"Set to ON to skip building ZM with rtsp server support. default: OFF")
|
2015-05-19 19:12:34 +08:00
|
|
|
set(ZM_PERL_MM_PARMS INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 CACHE STRING
|
|
|
|
"By default, ZoneMinder's Perl modules are installed into the Vendor folders,
|
|
|
|
as defined by your installation of Perl. You can change that here. Consult Perl's
|
|
|
|
MakeMaker documentation for a definition of acceptable parameters. If you set this
|
|
|
|
to something that causes the modules to be installed outside Perl's normal search
|
|
|
|
path, then you will also need to set ZM_PERL_SEARCH_PATH accordingly.")
|
|
|
|
set(ZM_PERL_SEARCH_PATH "" CACHE PATH
|
|
|
|
"Use to add a folder to your Perl's search path. This will need to be set in cases
|
|
|
|
where ZM_PERL_MM_PARMS has been modified such that ZoneMinder's Perl modules are
|
|
|
|
installed outside Perl's default search path.")
|
2015-04-15 20:09:25 +08:00
|
|
|
set(ZM_TARGET_DISTRO "" CACHE STRING
|
2018-04-22 20:25:06 +08:00
|
|
|
"Build ZoneMinder for a specific distribution. Currently, valid names are: fc27, fc26, el7, OS13, FreeBSD")
|
2017-02-05 05:34:57 +08:00
|
|
|
set(ZM_SYSTEMD "OFF" CACHE BOOL
|
|
|
|
"Set to ON to force building ZM with systemd support. default: OFF")
|
2018-12-07 23:47:00 +08:00
|
|
|
set(ZM_MANPAGE_DEST_PREFIX "share/man" CACHE PATH
|
|
|
|
"Relative path used to install ZoneMinder's Man pages into a
|
|
|
|
non-standard folder. Most Linux users will not need to change this.
|
|
|
|
BSD users may need to set this.")
|
2021-06-19 01:12:01 +08:00
|
|
|
set(ZM_CAKEPHP_CACHE "Apc" CACHE STRING
|
|
|
|
"Set the CakePHP cache engine, default: Apc")
|
2014-03-20 08:07:36 +08:00
|
|
|
|
2021-05-24 20:25:52 +08:00
|
|
|
# Supported crypto backends. Using OpenSSL by default to be compatible with jwt-cpp.
|
|
|
|
set(ZM_CRYPTO_BACKEND_OPTIONS gnutls openssl)
|
|
|
|
set(ZM_CRYPTO_BACKEND openssl CACHE STRING "Determines which crypto backend should be used.")
|
|
|
|
set_property(CACHE ZM_CRYPTO_BACKEND PROPERTY STRINGS ${ZM_CRYPTO_BACKEND_OPTIONS})
|
|
|
|
|
|
|
|
if(NOT ZM_CRYPTO_BACKEND IN_LIST ZM_CRYPTO_BACKEND_OPTIONS)
|
|
|
|
message(FATAL_ERROR "Invalid value for ZM_CRYPTO_BACKEND. Possible options: ${ZM_CRYPTO_BACKEND_OPTIONS}")
|
|
|
|
endif()
|
|
|
|
|
2021-05-24 21:34:59 +08:00
|
|
|
# Supported JWT backends. Using jwt-cpp as default.
|
|
|
|
set(ZM_JWT_BACKEND_OPTIONS libjwt jwt_cpp)
|
|
|
|
set(ZM_JWT_BACKEND jwt_cpp CACHE STRING "Determines which JWT backend should be used.")
|
|
|
|
set_property(CACHE ZM_JWT_BACKEND PROPERTY STRINGS ${ZM_JWT_BACKEND_OPTIONS})
|
|
|
|
|
|
|
|
if(NOT ZM_JWT_BACKEND IN_LIST ZM_JWT_BACKEND_OPTIONS)
|
|
|
|
message(FATAL_ERROR "Invalid value for ZM_JWT_BACKEND. Possible options: ${ZM_JWT_BACKEND_OPTIONS}")
|
|
|
|
endif()
|
|
|
|
|
2014-03-20 08:07:36 +08:00
|
|
|
# Reassign some variables if a target distro has been specified
|
2021-06-19 01:12:01 +08:00
|
|
|
if(ZM_TARGET_DISTRO MATCHES "^fc")
|
|
|
|
set(ZM_CAKEPHP_CACHE "Memcached")
|
|
|
|
endif()
|
|
|
|
|
2017-06-07 00:56:53 +08:00
|
|
|
if((ZM_TARGET_DISTRO MATCHES "^el") OR (ZM_TARGET_DISTRO MATCHES "^fc"))
|
2015-02-09 06:16:31 +08:00
|
|
|
set(ZM_RUNDIR "/var/run/zoneminder")
|
|
|
|
set(ZM_SOCKDIR "/var/lib/zoneminder/sock")
|
|
|
|
set(ZM_TMPDIR "/var/lib/zoneminder/temp")
|
|
|
|
set(ZM_LOGDIR "/var/log/zoneminder")
|
|
|
|
set(ZM_CONFIG_DIR "/etc/zm")
|
2017-06-06 04:39:19 +08:00
|
|
|
set(ZM_CONFIG_SUBDIR "/etc/zm/conf.d")
|
2015-02-15 19:34:27 +08:00
|
|
|
set(ZM_WEBDIR "/usr/share/zoneminder/www")
|
|
|
|
set(ZM_CGIDIR "/usr/libexec/zoneminder/cgi-bin")
|
2017-06-13 09:39:37 +08:00
|
|
|
set(ZM_DIR_EVENTS "/var/lib/zoneminder/events")
|
|
|
|
set(ZM_PATH_ZMS "/cgi-bin-zm/nph-zms")
|
2014-03-20 08:07:36 +08:00
|
|
|
elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
|
|
|
|
set(ZM_RUNDIR "/var/run/zoneminder")
|
|
|
|
set(ZM_TMPDIR "/var/run/zoneminder")
|
|
|
|
set(ZM_CONTENTDIR "/var/run/zoneminder")
|
|
|
|
set(ZM_LOGDIR "/var/log/zoneminder")
|
|
|
|
set(ZM_WEB_USER "wwwrun")
|
|
|
|
set(ZM_WEB_GROUP "www")
|
|
|
|
set(ZM_WEBDIR "/srv/www/htdocs/zoneminder")
|
|
|
|
set(ZM_CGIDIR "/srv/www/cgi-bin")
|
2016-04-06 19:45:21 +08:00
|
|
|
elseif(ZM_TARGET_DISTRO STREQUAL "FreeBSD")
|
2016-03-11 21:38:29 +08:00
|
|
|
set(ZM_RUNDIR "/var/run/zm")
|
|
|
|
set(ZM_SOCKDIR "/var/run/zm")
|
|
|
|
set(ZM_TMPDIR "/var/tmp/zm")
|
|
|
|
set(ZM_CONTENTDIR "/usr/local/var/lib/zoneminder")
|
|
|
|
set(ZM_WEB_USER "www")
|
|
|
|
set(ZM_WEB_GROUP "www")
|
|
|
|
set(ZM_CONFIG_DIR "/usr/local/etc/zm")
|
2017-06-06 04:39:19 +08:00
|
|
|
set(ZM_CONFIG_SUBDIR "/usr/local/etc/zm/conf.d")
|
2016-03-11 21:38:29 +08:00
|
|
|
set(ZM_WEBDIR "/usr/local/share/zoneminder/www")
|
|
|
|
set(ZM_CGIDIR "/usr/local/libexec/zoneminder/cgi-bin")
|
2016-03-12 05:56:29 +08:00
|
|
|
set(ZM_PERL_MM_PARMS "INSTALLDIRS=site")
|
2017-06-07 00:56:53 +08:00
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2021-02-04 04:22:28 +08:00
|
|
|
if(BUILD_MAN)
|
|
|
|
message(STATUS "Building man pages: Yes (default)")
|
|
|
|
set(ZM_PERL_MM_PARMS_FULL ${ZM_PERL_MM_PARMS})
|
|
|
|
else()
|
|
|
|
message(STATUS "Building man pages: No")
|
|
|
|
list(APPEND ZM_PERL_MM_PARMS_FULL ${ZM_PERL_MM_PARMS}
|
|
|
|
"INSTALLMAN1DIR=none"
|
|
|
|
"INSTALLMAN3DIR=none")
|
|
|
|
endif()
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Required for certain checks to work
|
2015-04-15 20:09:25 +08:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
|
2013-09-28 17:59:50 +08:00
|
|
|
# This is required to enable searching in lib64 (if exists), do not change
|
|
|
|
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
|
|
|
|
|
2017-02-05 05:34:57 +08:00
|
|
|
# Set the systemd flag if systemd is autodetected or ZM_SYSTEMD has been set
|
|
|
|
if(ZM_SYSTEMD OR (IS_DIRECTORY /usr/lib/systemd/system) OR (IS_DIRECTORY /lib/systemd/system))
|
|
|
|
set(WITH_SYSTEMD 1)
|
|
|
|
endif()
|
|
|
|
|
2013-10-09 20:41:14 +08:00
|
|
|
# System checks
|
2013-09-28 17:59:50 +08:00
|
|
|
check_include_file("execinfo.h" HAVE_EXECINFO_H)
|
2015-10-03 01:37:50 +08:00
|
|
|
if(HAVE_EXECINFO_H)
|
|
|
|
check_function_exists("backtrace" HAVE_DECL_BACKTRACE)
|
|
|
|
if(NOT HAVE_DECL_BACKTRACE)
|
|
|
|
find_library(EXECINFO_LIBRARY NAMES execinfo)
|
|
|
|
if(EXECINFO_LIBRARY)
|
2016-03-11 05:00:21 +08:00
|
|
|
list(APPEND ZM_BIN_LIBS "-lexecinfo")
|
2015-10-03 01:37:50 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
check_function_exists("backtrace_symbols" HAVE_DECL_BACKTRACE_SYMBOLS)
|
|
|
|
endif()
|
2013-10-06 23:26:33 +08:00
|
|
|
check_include_file("ucontext.h" HAVE_UCONTEXT_H)
|
2013-09-28 17:59:50 +08:00
|
|
|
check_include_file("sys/sendfile.h" HAVE_SYS_SENDFILE_H)
|
|
|
|
check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
|
2013-10-03 20:08:09 +08:00
|
|
|
check_function_exists("syscall" HAVE_SYSCALL)
|
2013-09-28 17:59:50 +08:00
|
|
|
check_function_exists("sendfile" HAVE_SENDFILE)
|
|
|
|
check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN)
|
2013-10-06 23:23:00 +08:00
|
|
|
check_type_size("siginfo_t" HAVE_SIGINFO_T)
|
|
|
|
check_type_size("ucontext_t" HAVE_UCONTEXT_T)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
|
|
|
# *** LIBRARY CHECKS ***
|
|
|
|
|
2015-07-03 22:53:23 +08:00
|
|
|
if(UNIX)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
|
|
|
if(NOT HAVE_CLOCK_GETTIME)
|
|
|
|
message(FATAL_ERROR "clock_gettime not found")
|
|
|
|
else()
|
|
|
|
list(APPEND ZM_BIN_LIBS "-lrt")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# zlib
|
|
|
|
find_package(ZLIB)
|
|
|
|
if(ZLIB_FOUND)
|
|
|
|
set(HAVE_LIBZLIB 1)
|
2013-11-15 17:12:33 +08:00
|
|
|
list(APPEND ZM_BIN_LIBS "${ZLIB_LIBRARIES}")
|
|
|
|
include_directories("${ZLIB_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIR}")
|
2013-09-28 17:59:50 +08:00
|
|
|
check_include_file("zlib.h" HAVE_ZLIB_H)
|
2013-10-21 22:13:07 +08:00
|
|
|
set(optlibsfound "${optlibsfound} zlib")
|
2013-10-14 12:58:21 +08:00
|
|
|
else()
|
2013-10-21 22:13:07 +08:00
|
|
|
set(optlibsnotfound "${optlibsnotfound} zlib")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2013-12-28 00:02:32 +08:00
|
|
|
# Do not check for cURL if ZM_NO_CURL is on
|
|
|
|
if(NOT ZM_NO_CURL)
|
|
|
|
# cURL
|
|
|
|
find_package(CURL)
|
|
|
|
if(CURL_FOUND)
|
|
|
|
set(HAVE_LIBCURL 1)
|
2020-04-08 17:18:16 +08:00
|
|
|
#list(APPEND ZM_BIN_LIBS ${CURL_LIBRARIES})
|
2013-12-28 00:02:32 +08:00
|
|
|
include_directories(${CURL_INCLUDE_DIRS})
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
|
|
|
|
check_include_file("curl/curl.h" HAVE_CURL_CURL_H)
|
|
|
|
set(optlibsfound "${optlibsfound} cURL")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} cURL")
|
|
|
|
endif()
|
2013-12-28 00:04:24 +08:00
|
|
|
endif()
|
2013-11-04 22:57:22 +08:00
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# jpeg
|
|
|
|
find_package(JPEG)
|
|
|
|
if(JPEG_FOUND)
|
|
|
|
set(HAVE_LIBJPEG 1)
|
2013-11-15 17:12:33 +08:00
|
|
|
list(APPEND ZM_BIN_LIBS "${JPEG_LIBRARIES}")
|
2013-10-09 20:41:14 +08:00
|
|
|
#link_directories(${JPEG_LIBRARY})
|
2013-11-15 17:12:33 +08:00
|
|
|
include_directories("${JPEG_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}")
|
2013-09-28 17:59:50 +08:00
|
|
|
check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
|
2013-10-09 20:41:14 +08:00
|
|
|
if(NOT HAVE_JPEGLIB_H)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR
|
|
|
|
"ZoneMinder requires libjpeg headers - check that libjpeg development packages are installed")
|
2013-10-09 20:41:14 +08:00
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
else()
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR
|
|
|
|
"ZoneMinder requires jpeg but it was not found on your system")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-05-24 21:34:59 +08:00
|
|
|
# libjwt
|
|
|
|
if (${ZM_JWT_BACKEND} STREQUAL "libjwt")
|
|
|
|
find_package(LibJWT REQUIRED COMPONENTS ${ZM_CRYPTO_BACKEND})
|
|
|
|
if(LIBJWT_FOUND)
|
|
|
|
set(HAVE_LIBJWT 1)
|
|
|
|
set(optlibsfound "${optlibsfound} LIBJWT")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} LIBJWT")
|
|
|
|
endif()
|
2020-03-06 01:29:27 +08:00
|
|
|
endif()
|
|
|
|
|
2021-05-24 20:25:52 +08:00
|
|
|
# GnuTLS
|
|
|
|
if (${ZM_CRYPTO_BACKEND} STREQUAL "gnutls")
|
|
|
|
find_library(GNUTLS_LIBRARIES gnutls REQUIRED)
|
2020-04-14 03:10:47 +08:00
|
|
|
if(GNUTLS_LIBRARIES)
|
|
|
|
set(HAVE_LIBGNUTLS 1)
|
|
|
|
list(APPEND ZM_BIN_LIBS "${GNUTLS_LIBRARIES}")
|
|
|
|
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h)
|
|
|
|
if(GNUTLS_INCLUDE_DIR)
|
|
|
|
include_directories("${GNUTLS_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR)
|
|
|
|
set(optlibsfound "${optlibsfound} GnuTLS")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} GnuTLS")
|
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
# OpenSSL
|
2021-05-24 20:25:52 +08:00
|
|
|
elseif (${ZM_CRYPTO_BACKEND} STREQUAL "openssl")
|
|
|
|
find_package(OpenSSL REQUIRED)
|
2020-03-06 01:29:27 +08:00
|
|
|
if(OPENSSL_FOUND)
|
|
|
|
set(HAVE_LIBOPENSSL 1)
|
|
|
|
list(APPEND ZM_BIN_LIBS "${OPENSSL_LIBRARIES}")
|
|
|
|
include_directories("${OPENSSL_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
|
|
|
|
set(optlibsfound "${optlibsfound} OpenSSL")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} OpenSSL")
|
|
|
|
endif()
|
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2013-10-09 20:41:14 +08:00
|
|
|
# pthread (using find_library and find_path)
|
2013-09-28 17:59:50 +08:00
|
|
|
find_library(PTHREAD_LIBRARIES pthread)
|
|
|
|
if(PTHREAD_LIBRARIES)
|
|
|
|
set(HAVE_LIBPTHREAD 1)
|
2013-11-15 17:12:33 +08:00
|
|
|
list(APPEND ZM_BIN_LIBS "${PTHREAD_LIBRARIES}")
|
2013-10-09 20:41:14 +08:00
|
|
|
find_path(PTHREAD_INCLUDE_DIR pthread.h)
|
|
|
|
if(PTHREAD_INCLUDE_DIR)
|
2013-11-15 17:12:33 +08:00
|
|
|
include_directories("${PTHREAD_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${PTHREAD_INCLUDE_DIR}")
|
2013-10-09 20:41:14 +08:00
|
|
|
endif()
|
|
|
|
mark_as_advanced(FORCE PTHREAD_LIBRARIES PTHREAD_INCLUDE_DIR)
|
2013-09-28 17:59:50 +08:00
|
|
|
check_include_file("pthread.h" HAVE_PTHREAD_H)
|
2013-10-09 20:41:14 +08:00
|
|
|
if(NOT HAVE_PTHREAD_H)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR "ZoneMinder requires pthread headers - check that pthread development packages are installed")
|
2013-10-09 20:41:14 +08:00
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
else()
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR "ZoneMinder requires pthread but it was not found on your system")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-11-25 01:44:07 +08:00
|
|
|
# Do not check for cURL if ZM_NO_CURL is on
|
|
|
|
if(NOT ZM_NO_PRCE)
|
|
|
|
# pcre (using find_library and find_path)
|
|
|
|
find_library(PCRE_LIBRARIES pcre)
|
|
|
|
if(PCRE_LIBRARIES)
|
|
|
|
set(HAVE_LIBPCRE 1)
|
|
|
|
list(APPEND ZM_BIN_LIBS "${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}")
|
|
|
|
endif()
|
|
|
|
mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR)
|
|
|
|
check_include_file("pcre.h" HAVE_PCRE_H)
|
|
|
|
set(optlibsfound "${optlibsfound} PCRE")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} PCRE")
|
2013-10-09 20:41:14 +08:00
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2013-10-09 20:41:14 +08:00
|
|
|
# mysqlclient (using find_library and find_path)
|
2013-09-28 17:59:50 +08:00
|
|
|
find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
|
|
|
|
if(MYSQLCLIENT_LIBRARIES)
|
|
|
|
set(HAVE_LIBMYSQLCLIENT 1)
|
2013-11-15 17:12:33 +08:00
|
|
|
list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}")
|
2017-05-10 21:06:48 +08:00
|
|
|
find_path(MYSQLCLIENT_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql)
|
2013-10-09 20:41:14 +08:00
|
|
|
if(MYSQLCLIENT_INCLUDE_DIR)
|
2013-11-15 17:12:33 +08:00
|
|
|
include_directories("${MYSQLCLIENT_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${MYSQLCLIENT_INCLUDE_DIR}")
|
2013-10-09 20:41:14 +08:00
|
|
|
endif()
|
|
|
|
mark_as_advanced(FORCE MYSQLCLIENT_LIBRARIES MYSQLCLIENT_INCLUDE_DIR)
|
2017-01-31 15:59:22 +08:00
|
|
|
check_include_file("mysql.h" HAVE_MYSQL_H)
|
2013-10-09 20:41:14 +08:00
|
|
|
if(NOT HAVE_MYSQL_H)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR "ZoneMinder requires MySQL headers - check that MySQL development packages are installed")
|
2013-10-09 20:41:14 +08:00
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
else()
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR "ZoneMinder requires mysqlclient but it was not found on your system")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-06-06 02:39:48 +08:00
|
|
|
find_package(FFMPEG 55.34.100 REQUIRED
|
2021-06-05 19:54:46 +08:00
|
|
|
COMPONENTS
|
2021-06-05 20:00:21 +08:00
|
|
|
avcodec
|
2021-06-05 19:54:46 +08:00
|
|
|
avformat
|
2021-06-05 20:12:20 +08:00
|
|
|
avutil
|
2021-06-05 20:19:32 +08:00
|
|
|
swresample
|
2021-06-05 20:12:20 +08:00
|
|
|
swscale)
|
2021-06-05 19:54:46 +08:00
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${FFMPEG_avutil_INCLUDE_DIRS})
|
|
|
|
check_include_file("libavutil/hwcontext.h" HAVE_LIBAVUTIL_HWCONTEXT_H)
|
2018-12-28 23:46:27 +08:00
|
|
|
|
2021-06-05 02:44:55 +08:00
|
|
|
set(PATH_FFMPEG "")
|
|
|
|
set(OPT_FFMPEG "no")
|
|
|
|
|
2018-12-28 23:46:27 +08:00
|
|
|
# Find the path to the ffmpeg executable
|
|
|
|
find_program(FFMPEG_EXECUTABLE
|
|
|
|
NAMES ffmpeg avconv
|
|
|
|
PATH_SUFFIXES ffmpeg)
|
|
|
|
if(FFMPEG_EXECUTABLE)
|
|
|
|
set(PATH_FFMPEG "${FFMPEG_EXECUTABLE}")
|
|
|
|
set(OPT_FFMPEG "yes")
|
|
|
|
mark_as_advanced(FFMPEG_EXECUTABLE)
|
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2013-12-13 01:45:29 +08:00
|
|
|
# Do not check for libvlc if ZM_NO_LIBVLC is on
|
|
|
|
if(NOT ZM_NO_LIBVLC)
|
|
|
|
# libvlc (using find_library and find_path)
|
|
|
|
find_library(LIBVLC_LIBRARIES vlc)
|
|
|
|
if(LIBVLC_LIBRARIES)
|
|
|
|
set(HAVE_LIBVLC 1)
|
2020-04-14 01:11:57 +08:00
|
|
|
#list(APPEND ZM_BIN_LIBS "${LIBVLC_LIBRARIES}")
|
2013-12-13 01:45:29 +08:00
|
|
|
find_path(LIBVLC_INCLUDE_DIR "vlc/vlc.h")
|
|
|
|
if(LIBVLC_INCLUDE_DIR)
|
|
|
|
include_directories("${LIBVLC_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${LIBVLC_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
mark_as_advanced(FORCE LIBVLC_LIBRARIES LIBVLC_INCLUDE_DIR)
|
2013-12-21 12:47:12 +08:00
|
|
|
check_include_file("vlc/vlc.h" HAVE_VLC_VLC_H)
|
2013-12-13 01:45:29 +08:00
|
|
|
set(optlibsfound "${optlibsfound} libVLC")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} libVLC")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-03-26 14:29:22 +08:00
|
|
|
if(NOT ZM_NO_LIBVNC)
|
|
|
|
# libvncclient (using find_library and find_path)
|
|
|
|
find_library(LIBVNC_LIBRARIES vncclient)
|
|
|
|
if(LIBVNC_LIBRARIES)
|
|
|
|
set(HAVE_LIBVNC 1)
|
2020-04-14 05:39:26 +08:00
|
|
|
#list(APPEND ZM_BIN_LIBS "${LIBVNC_LIBRARIES}")
|
2020-03-26 14:29:22 +08:00
|
|
|
find_path(LIBVNC_INCLUDE_DIR "rfb/rfb.h")
|
|
|
|
if(LIBVNC_INCLUDE_DIR)
|
|
|
|
include_directories("${LIBVNC_INCLUDE_DIR}")
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${LIBVNC_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
mark_as_advanced(FORCE LIBVNC_LIBRARIES LIBVNC_INCLUDE_DIR)
|
|
|
|
check_include_file("rfb/rfb.h" HAVE_RFB_RFB_H)
|
|
|
|
set(optlibsfound "${optlibsfound} libVNC")
|
|
|
|
else()
|
|
|
|
set(optlibsnotfound "${optlibsnotfound} libVNC")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-01-03 01:16:37 +08:00
|
|
|
#find_package(Boost 1.36.0)
|
|
|
|
#if(Boost_FOUND)
|
|
|
|
#include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
##set(CMAKE_REQUIRED_INCLUDES "${Boost_INCLUDE_DIRS}")
|
|
|
|
#list(APPEND ZM_BIN_LIBS "${Boost_LIBRARIES}")
|
|
|
|
#endif()
|
2020-12-09 04:59:06 +08:00
|
|
|
|
|
|
|
if(NOT ZM_NO_RTSPSERVER)
|
2021-03-11 21:07:45 +08:00
|
|
|
set(HAVE_RTSP_SERVER 1)
|
2020-12-09 04:59:06 +08:00
|
|
|
else()
|
|
|
|
set(HAVE_RTSP_SERVER 0)
|
|
|
|
endif()
|
|
|
|
|
2018-01-03 01:16:37 +08:00
|
|
|
#
|
2013-09-28 17:59:50 +08:00
|
|
|
# *** END OF LIBRARY CHECKS ***
|
|
|
|
|
2021-05-24 20:25:52 +08:00
|
|
|
# If libjwt is not present we fall back to jwt-cpp which requires OpenSSL
|
|
|
|
if((NOT HAVE_LIBJWT) AND (NOT HAVE_LIBOPENSSL))
|
|
|
|
message(FATAL_ERROR "Using the jwt-cpp backend requires OpenSSL as crypto backend.")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-09-08 05:15:40 +08:00
|
|
|
find_package(V4L2)
|
|
|
|
if(TARGET V4L2::videodev2)
|
2013-09-28 17:59:50 +08:00
|
|
|
set(ZM_HAS_V4L2 1)
|
2021-09-08 05:15:40 +08:00
|
|
|
else()
|
2021-09-08 06:15:59 +08:00
|
|
|
set(ZM_HAS_V4L2 0)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(AUTHOR_WARNING "Video 4 Linux headers weren't found - Analog and USB camera support will not be available")
|
|
|
|
endif()
|
2021-09-08 05:15:40 +08:00
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Check for PCRE and enable ZM_PCRE accordingly
|
2013-10-09 21:05:56 +08:00
|
|
|
set(ZM_PCRE 0)
|
2013-09-28 17:59:50 +08:00
|
|
|
if(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
|
|
|
set(ZM_PCRE 1)
|
|
|
|
endif()
|
2021-11-25 01:44:07 +08:00
|
|
|
|
2013-10-09 21:05:56 +08:00
|
|
|
# Check for mmap and enable in all components
|
|
|
|
set(ZM_MEM_MAPPED 0)
|
2013-10-09 20:41:14 +08:00
|
|
|
set(ENABLE_MMAP no)
|
|
|
|
if(NOT ZM_NO_MMAP)
|
|
|
|
set(ZM_MEM_MAPPED 1)
|
|
|
|
set(ENABLE_MMAP yes)
|
|
|
|
set(ZM_MMAP_PERLPACKAGE "Sys::Mmap")
|
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2015-02-22 01:12:07 +08:00
|
|
|
# Check for the ONVIF flag and enable ZM_HAS_ONVIF accordingly
|
|
|
|
set(ZM_HAS_ONVIF 0)
|
|
|
|
if(ZM_ONVIF)
|
|
|
|
set(ZM_HAS_ONVIF 1)
|
|
|
|
endif()
|
|
|
|
|
2013-10-09 20:41:14 +08:00
|
|
|
# Check for Perl
|
2013-09-28 17:59:50 +08:00
|
|
|
find_package(Perl)
|
|
|
|
if(NOT PERL_FOUND)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR "ZoneMinder requires Perl 5.6.0 or newer but it was not found on your system")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
2013-10-09 20:41:14 +08:00
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Checking for perl modules requires FindPerlModules.cmake
|
|
|
|
# Check all required modules at once
|
|
|
|
# TODO: Add checking for the optional modules
|
2015-04-15 20:09:25 +08:00
|
|
|
find_package(
|
|
|
|
PerlModules COMPONENTS Sys::Syslog DBI DBD::mysql
|
|
|
|
Getopt::Long Time::HiRes Date::Manip LWP::UserAgent
|
|
|
|
ExtUtils::MakeMaker ${ZM_MMAP_PERLPACKAGE})
|
2013-09-28 17:59:50 +08:00
|
|
|
if(NOT PERLMODULES_FOUND)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(WARNING "Not all required perl modules were found on your system")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
2015-04-15 20:09:25 +08:00
|
|
|
# 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
|
2013-09-28 17:59:50 +08:00
|
|
|
if(ZM_WEB_USER STREQUAL "")
|
2015-04-15 20:09:25 +08:00
|
|
|
# Check for a user matching ^apache and cut the username from the
|
|
|
|
# userline in the first match
|
2013-09-28 17:59:50 +08:00
|
|
|
file(STRINGS "/etc/passwd" userline_apache REGEX "^apache")
|
|
|
|
file(STRINGS "/etc/passwd" userline_www REGEX "^www")
|
|
|
|
if(NOT (userline_apache STREQUAL ""))
|
2015-04-15 20:09:25 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND echo ${userline_apache}
|
|
|
|
COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2013-09-28 17:59:50 +08:00
|
|
|
elseif(NOT (userline_www STREQUAL ""))
|
2015-04-15 20:09:25 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND echo ${userline_www}
|
|
|
|
COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
message(STATUS "Detected web server user: ${ZM_WEB_USER}")
|
|
|
|
endif()
|
|
|
|
# Check if webgroup contains anything. If not, use the web user as the web group
|
|
|
|
if(NOT ZM_WEB_GROUP)
|
|
|
|
set(ZM_WEB_GROUP ${ZM_WEB_USER})
|
|
|
|
endif()
|
|
|
|
message(STATUS "Using web user: ${ZM_WEB_USER}")
|
|
|
|
message(STATUS "Using web group: ${ZM_WEB_GROUP}")
|
|
|
|
|
2017-02-05 05:34:57 +08:00
|
|
|
if(WITH_SYSTEMD)
|
|
|
|
# Check for polkit
|
2017-01-31 15:59:22 +08:00
|
|
|
find_package(Polkit)
|
|
|
|
if(NOT POLKIT_FOUND)
|
|
|
|
message(WARNING "Running ZoneMinder requires polkit. Building ZoneMinder requires the polkit development package.")
|
|
|
|
endif()
|
2017-02-05 05:34:57 +08:00
|
|
|
endif()
|
2014-08-10 21:47:11 +08:00
|
|
|
|
2018-07-12 03:43:59 +08:00
|
|
|
# Find the path to an arp compatible executable
|
|
|
|
if(ZM_PATH_ARP STREQUAL "")
|
|
|
|
find_program(ARP_EXECUTABLE arp)
|
|
|
|
if(ARP_EXECUTABLE)
|
|
|
|
set(ZM_PATH_ARP "${ARP_EXECUTABLE}")
|
|
|
|
mark_as_advanced(ARP_EXECUTABLE)
|
2021-02-05 05:00:56 +08:00
|
|
|
else()
|
2018-07-12 03:43:59 +08:00
|
|
|
find_program(ARP_EXECUTABLE ip)
|
|
|
|
if(ARP_EXECUTABLE)
|
|
|
|
set(ZM_PATH_ARP "${ARP_EXECUTABLE} neigh")
|
|
|
|
mark_as_advanced(ARP_EXECUTABLE)
|
2021-02-05 05:00:56 +08:00
|
|
|
endif()
|
2018-07-12 03:43:59 +08:00
|
|
|
endif()
|
|
|
|
if(ARP_EXECUTABLE-NOTFOUND)
|
|
|
|
message(WARNING "Unable to find a compatible arp binary. Monitor probe will not function.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Some variables that zm expects
|
|
|
|
set(ZM_PID "${ZM_RUNDIR}/zm.pid")
|
2014-11-11 23:15:15 +08:00
|
|
|
set(ZM_CONFIG "${ZM_CONFIG_DIR}/zm.conf")
|
2013-10-09 20:41:14 +08:00
|
|
|
set(VERSION "${zoneminder_VERSION}")
|
2015-06-14 00:30:28 +08:00
|
|
|
set(API_VERSION "${zoneminder_API_VERSION}")
|
2013-10-06 22:12:02 +08:00
|
|
|
set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder")
|
2013-09-28 17:59:50 +08:00
|
|
|
set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}")
|
|
|
|
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
|
|
|
set(SYSCONFDIR "/${CMAKE_INSTALL_SYSCONFDIR}")
|
|
|
|
set(WEB_PREFIX "${ZM_WEBDIR}")
|
|
|
|
set(CGI_PREFIX "${ZM_CGIDIR}")
|
|
|
|
set(WEB_USER "${ZM_WEB_USER}")
|
|
|
|
set(WEB_GROUP "${ZM_WEB_GROUP}")
|
2013-11-05 04:38:21 +08:00
|
|
|
set(ZM_DB_TYPE "mysql")
|
2015-04-11 01:09:01 +08:00
|
|
|
if(ZM_PERL_SEARCH_PATH)
|
|
|
|
set(EXTRA_PERL_LIB "use lib '${ZM_PERL_SEARCH_PATH}'; # Include custom perl install path")
|
|
|
|
else()
|
|
|
|
set(EXTRA_PERL_LIB "# Include from system perl paths only")
|
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2017-06-06 04:39:19 +08:00
|
|
|
# If this is an out-of-source build, copy the files we need to the binary directory
|
|
|
|
if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR))
|
2017-08-14 21:45:03 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/conf.d" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" PATTERN "*.in" EXCLUDE)
|
2017-06-06 04:39:19 +08:00
|
|
|
endif()
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Generate files from the .in files
|
2013-11-04 15:56:40 +08:00
|
|
|
configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY)
|
2017-07-17 21:11:36 +08:00
|
|
|
configure_file(conf.d/01-system-paths.conf.in "${CMAKE_CURRENT_BINARY_DIR}/conf.d/01-system-paths.conf" @ONLY)
|
2013-11-04 15:56:40 +08:00
|
|
|
configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
|
|
|
|
configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY)
|
|
|
|
configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2015-06-21 06:33:13 +08:00
|
|
|
# Create a target for man pages
|
|
|
|
include(Pod2Man)
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Process subdirectories
|
2021-02-28 03:32:37 +08:00
|
|
|
add_subdirectory(dep)
|
2013-09-28 17:59:50 +08:00
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(scripts)
|
|
|
|
add_subdirectory(db)
|
2020-12-01 22:21:25 +08:00
|
|
|
add_subdirectory(fonts)
|
2013-09-28 17:59:50 +08:00
|
|
|
add_subdirectory(web)
|
2014-08-10 21:47:11 +08:00
|
|
|
add_subdirectory(misc)
|
2014-07-15 23:41:05 +08:00
|
|
|
add_subdirectory(onvif)
|
2013-10-21 21:11:37 +08:00
|
|
|
|
2021-02-03 05:57:50 +08:00
|
|
|
if(BUILD_TEST_SUITE)
|
|
|
|
message("Building unit tests: Yes")
|
|
|
|
find_package(Catch2 REQUIRED)
|
|
|
|
|
|
|
|
include(CTest)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
else()
|
|
|
|
message("Building unit tests: No (default)")
|
|
|
|
endif()
|
|
|
|
|
2014-08-10 21:47:11 +08:00
|
|
|
# Process distro subdirectories
|
2017-06-07 00:59:56 +08:00
|
|
|
if((ZM_TARGET_DISTRO MATCHES "^el") OR (ZM_TARGET_DISTRO MATCHES "^fc"))
|
2013-10-21 21:11:37 +08:00
|
|
|
add_subdirectory(distros/redhat)
|
2014-03-20 08:07:36 +08:00
|
|
|
elseif()
|
|
|
|
add_subdirectory(distros/opensuse)
|
2017-06-07 00:59:56 +08:00
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2013-10-14 12:58:21 +08:00
|
|
|
# Print optional libraries detection status
|
|
|
|
message(STATUS "Optional libraries found:${optlibsfound}")
|
|
|
|
message(STATUS "Optional libraries not found:${optlibsnotfound}")
|
|
|
|
|
2021-05-24 20:25:52 +08:00
|
|
|
message(STATUS "Enabled crypto backend: ${ZM_CRYPTO_BACKEND}")
|
2021-05-24 21:34:59 +08:00
|
|
|
message(STATUS "Enabled JWT backend: ${ZM_JWT_BACKEND}")
|
2021-05-24 20:25:52 +08:00
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# Run ZM configuration generator
|
|
|
|
message(STATUS "Running ZoneMinder configuration generator")
|
2020-02-28 01:00:09 +08:00
|
|
|
execute_process(COMMAND perl ${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl RESULT_VARIABLE ZMCONFGEN_RESULT)
|
2013-09-28 17:59:50 +08:00
|
|
|
if(ZMCONFGEN_RESULT EQUAL 0)
|
2015-04-15 20:09:25 +08:00
|
|
|
message(STATUS "ZoneMinder configuration generator completed successfully")
|
2013-09-28 17:59:50 +08:00
|
|
|
else()
|
2015-04-15 20:09:25 +08:00
|
|
|
message(FATAL_ERROR "ZoneMinder configuration generator failed. Exit code: ${zmconfgen_result}")
|
2013-09-28 17:59:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Install zm.conf
|
2017-05-19 00:07:04 +08:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
|
2017-07-17 21:11:36 +08:00
|
|
|
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2013-10-21 21:11:37 +08:00
|
|
|
# Uninstall target
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)
|
|
|
|
|
2016-07-24 07:26:10 +08:00
|
|
|
# Configure CCache if available
|
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
if(CCACHE_FOUND)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
endif()
|
2017-04-27 03:21:58 +08:00
|
|
|
|
2017-04-27 03:46:55 +08:00
|
|
|
install(DIRECTORY icons DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/")
|