diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c830af03..47ef21ac6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_C_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_C_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") -set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Modules that we need: @@ -63,7 +62,7 @@ set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING "MySQL engine to use with database, de 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_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 support. 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 /lib, default: ${CMAKE_INSTALL_LIBDIR}/perl5") +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 /lib, default: /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: /") set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6") @@ -96,9 +95,9 @@ check_type_size("ucontext_t" HAVE_UCONTEXT_T) find_package(ZLIB) if(ZLIB_FOUND) set(HAVE_LIBZLIB 1) - list(APPEND ZM_BIN_LIBS ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR}) + list(APPEND ZM_BIN_LIBS "${ZLIB_LIBRARIES}") + include_directories("${ZLIB_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIR}") check_include_file("zlib.h" HAVE_ZLIB_H) set(optlibsfound "${optlibsfound} zlib") else(ZLIB_FOUND) @@ -109,10 +108,10 @@ endif(ZLIB_FOUND) find_package(JPEG) if(JPEG_FOUND) set(HAVE_LIBJPEG 1) - list(APPEND ZM_BIN_LIBS ${JPEG_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${JPEG_LIBRARIES}") #link_directories(${JPEG_LIBRARY}) - include_directories(${JPEG_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) + include_directories("${JPEG_INCLUDE_DIR}") + 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") @@ -126,9 +125,9 @@ find_package(OpenSSL) if(OPENSSL_FOUND) set(HAVE_LIBOPENSSL 1) set(HAVE_LIBCRYPTO 1) - list(APPEND ZM_BIN_LIBS ${OPENSSL_LIBRARIES}) - include_directories(${OPENSSL_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + list(APPEND ZM_BIN_LIBS "${OPENSSL_LIBRARIES}") + include_directories("${OPENSSL_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H) set(optlibsfound "${optlibsfound} OpenSSL") else(OPENSSL_FOUND) @@ -139,11 +138,11 @@ endif(OPENSSL_FOUND) find_library(PTHREAD_LIBRARIES pthread) if(PTHREAD_LIBRARIES) set(HAVE_LIBPTHREAD 1) - list(APPEND ZM_BIN_LIBS ${PTHREAD_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${PTHREAD_LIBRARIES}") find_path(PTHREAD_INCLUDE_DIR pthread.h) if(PTHREAD_INCLUDE_DIR) - include_directories(${PTHREAD_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${PTHREAD_INCLUDE_DIR}) + include_directories("${PTHREAD_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${PTHREAD_INCLUDE_DIR}") endif(PTHREAD_INCLUDE_DIR) mark_as_advanced(FORCE PTHREAD_LIBRARIES PTHREAD_INCLUDE_DIR) check_include_file("pthread.h" HAVE_PTHREAD_H) @@ -158,11 +157,11 @@ endif(PTHREAD_LIBRARIES) find_library(PCRE_LIBRARIES pcre) if(PCRE_LIBRARIES) set(HAVE_LIBPCRE 1) - list(APPEND ZM_BIN_LIBS ${PCRE_LIBRARIES}) + 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}) + include_directories("${PCRE_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${PCRE_INCLUDE_DIR}") endif(PCRE_INCLUDE_DIR) mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR) check_include_file("pcre.h" HAVE_PCRE_H) @@ -175,11 +174,11 @@ endif(PCRE_LIBRARIES) find_library(GCRYPT_LIBRARIES gcrypt) if(GCRYPT_LIBRARIES) set(HAVE_LIBGCRYPT 1) - list(APPEND ZM_BIN_LIBS ${GCRYPT_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${GCRYPT_LIBRARIES}") find_path(GCRYPT_INCLUDE_DIR gcrypt.h) if(GCRYPT_INCLUDE_DIR) - include_directories(${GCRYPT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${GCRYPT_INCLUDE_DIR}) + include_directories("${GCRYPT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${GCRYPT_INCLUDE_DIR}") endif(GCRYPT_INCLUDE_DIR) mark_as_advanced(FORCE GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR) check_include_file("gcrypt.h" HAVE_GCRYPT_H) @@ -192,11 +191,11 @@ endif(GCRYPT_LIBRARIES) find_library(GNUTLS_LIBRARIES gnutls) if(GNUTLS_LIBRARIES) set(HAVE_LIBGNUTLS 1) - list(APPEND ZM_BIN_LIBS ${GNUTLS_LIBRARIES}) + 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}) + include_directories("${GNUTLS_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIR}") endif(GNUTLS_INCLUDE_DIR) mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR) check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H) @@ -210,11 +209,11 @@ endif(GNUTLS_LIBRARIES) find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql) if(MYSQLCLIENT_LIBRARIES) set(HAVE_LIBMYSQLCLIENT 1) - list(APPEND ZM_BIN_LIBS ${MYSQLCLIENT_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}") find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql.h) if(MYSQLCLIENT_INCLUDE_DIR) - include_directories(${MYSQLCLIENT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${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) check_include_file("mysql/mysql.h" HAVE_MYSQL_H) @@ -233,11 +232,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVFORMAT_LIBRARIES avformat) if(AVFORMAT_LIBRARIES) set(HAVE_LIBAVFORMAT 1) - list(APPEND ZM_BIN_LIBS ${AVFORMAT_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVFORMAT_LIBRARIES}") find_path(AVFORMAT_INCLUDE_DIR "libavformat/avformat.h") if(AVFORMAT_INCLUDE_DIR) - include_directories(${AVFORMAT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVFORMAT_INCLUDE_DIR}) + include_directories("${AVFORMAT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVFORMAT_INCLUDE_DIR}") endif(AVFORMAT_INCLUDE_DIR) mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR) check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H) @@ -250,11 +249,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVCODEC_LIBRARIES avcodec) if(AVCODEC_LIBRARIES) set(HAVE_LIBAVCODEC 1) - list(APPEND ZM_BIN_LIBS ${AVCODEC_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVCODEC_LIBRARIES}") find_path(AVCODEC_INCLUDE_DIR "libavcodec/avcodec.h") if(AVCODEC_INCLUDE_DIR) - include_directories(${AVCODEC_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVCODEC_INCLUDE_DIR}) + include_directories("${AVCODEC_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVCODEC_INCLUDE_DIR}") endif(AVCODEC_INCLUDE_DIR) mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR) check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H) @@ -267,11 +266,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVDEVICE_LIBRARIES avdevice) if(AVDEVICE_LIBRARIES) set(HAVE_LIBAVDEVICE 1) - list(APPEND ZM_BIN_LIBS ${AVDEVICE_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVDEVICE_LIBRARIES}") find_path(AVDEVICE_INCLUDE_DIR "libavdevice/avdevice.h") if(AVDEVICE_INCLUDE_DIR) - include_directories(${AVDEVICE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVDEVICE_INCLUDE_DIR}) + include_directories("${AVDEVICE_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVDEVICE_INCLUDE_DIR}") endif(AVDEVICE_INCLUDE_DIR) mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR) check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H) @@ -284,11 +283,11 @@ if(NOT ZM_NO_FFMPEG) find_library(AVUTIL_LIBRARIES avutil) if(AVUTIL_LIBRARIES) set(HAVE_LIBAVUTIL 1) - list(APPEND ZM_BIN_LIBS ${AVUTIL_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${AVUTIL_LIBRARIES}") find_path(AVUTIL_INCLUDE_DIR "libavutil/avutil.h") if(AVUTIL_INCLUDE_DIR) - include_directories(${AVUTIL_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVUTIL_INCLUDE_DIR}) + include_directories("${AVUTIL_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${AVUTIL_INCLUDE_DIR}") endif(AVUTIL_INCLUDE_DIR) mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR) check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H) @@ -302,11 +301,11 @@ if(NOT ZM_NO_FFMPEG) find_library(SWSCALE_LIBRARIES swscale) if(SWSCALE_LIBRARIES) set(HAVE_LIBSWSCALE 1) - list(APPEND ZM_BIN_LIBS ${SWSCALE_LIBRARIES}) + list(APPEND ZM_BIN_LIBS "${SWSCALE_LIBRARIES}") find_path(SWSCALE_INCLUDE_DIR "libswscale/swscale.h") if(SWSCALE_INCLUDE_DIR) - include_directories(${SWSCALE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${SWSCALE_INCLUDE_DIR}) + include_directories("${SWSCALE_INCLUDE_DIR}") + set(CMAKE_REQUIRED_INCLUDES "${SWSCALE_INCLUDE_DIR}") endif(SWSCALE_INCLUDE_DIR) mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR) check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H) @@ -364,18 +363,18 @@ endif(NOT ZM_NO_MMAP) # Check for authenication functions if(HAVE_OPENSSL_MD5_H) - set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + 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) endif(HAVE_OPENSSL_MD5_H) if(HAVE_GNUTLS_OPENSSL_H) - set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIR}) + 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) endif(HAVE_GNUTLS_OPENSSL_H) if(HAVE_GNUTLS_GNUTLS_H) - set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIR}) + 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) endif(HAVE_GNUTLS_GNUTLS_H) if(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)