Add detection status in cmake for optional libraries

This commit is contained in:
Kfir Itzhak 2013-10-14 07:58:21 +03:00
parent 7d6cca13b8
commit edcca74f95
1 changed files with 34 additions and 0 deletions

View File

@ -95,6 +95,9 @@ if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR}) include_directories(${ZLIB_INCLUDE_DIR})
set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR}) set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
check_include_file("zlib.h" HAVE_ZLIB_H) check_include_file("zlib.h" HAVE_ZLIB_H)
set(optlibsfound "${optlibsfound} ZLIB")
else(ZLIB_FOUND)
set(optlibsnotfound "${optlibsnotfound} ZLIB")
endif(ZLIB_FOUND) endif(ZLIB_FOUND)
# jpeg # jpeg
@ -122,6 +125,9 @@ if(OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H) check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H)
set(optlibsfound "${optlibsfound} OPENSSL")
else(OPENSSL_FOUND)
set(optlibsnotfound "${optlibsnotfound} OPENSSL")
endif(OPENSSL_FOUND) endif(OPENSSL_FOUND)
# pthread (using find_library and find_path) # pthread (using find_library and find_path)
@ -155,6 +161,9 @@ if(PCRE_LIBRARIES)
endif(PCRE_INCLUDE_DIR) endif(PCRE_INCLUDE_DIR)
mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR) mark_as_advanced(FORCE PCRE_LIBRARIES PCRE_INCLUDE_DIR)
check_include_file("pcre.h" HAVE_PCRE_H) check_include_file("pcre.h" HAVE_PCRE_H)
set(optlibsfound "${optlibsfound} PCRE")
else(PCRE_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} PCRE")
endif(PCRE_LIBRARIES) endif(PCRE_LIBRARIES)
# gcrypt (using find_library and find_path) # gcrypt (using find_library and find_path)
@ -169,6 +178,9 @@ if(GCRYPT_LIBRARIES)
endif(GCRYPT_INCLUDE_DIR) endif(GCRYPT_INCLUDE_DIR)
mark_as_advanced(FORCE GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR) mark_as_advanced(FORCE GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
check_include_file("gcrypt.h" HAVE_GCRYPT_H) check_include_file("gcrypt.h" HAVE_GCRYPT_H)
set(optlibsfound "${optlibsfound} GCRYPT")
else(GCRYPT_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} GCRYPT")
endif(GCRYPT_LIBRARIES) endif(GCRYPT_LIBRARIES)
# gnutls (using find_library and find_path) # gnutls (using find_library and find_path)
@ -184,6 +196,9 @@ if(GNUTLS_LIBRARIES)
mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR) mark_as_advanced(FORCE GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR)
check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H) check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H)
check_include_file("gnutls/gnutls.h" HAVE_GNUTLS_GNUTLS_H) check_include_file("gnutls/gnutls.h" HAVE_GNUTLS_GNUTLS_H)
set(optlibsfound "${optlibsfound} GNUTLS")
else(GNUTLS_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} GNUTLS")
endif(GNUTLS_LIBRARIES) endif(GNUTLS_LIBRARIES)
# mysqlclient (using find_library and find_path) # mysqlclient (using find_library and find_path)
@ -219,6 +234,9 @@ if(NOT ZM_NO_FFMPEG)
endif(AVFORMAT_INCLUDE_DIR) endif(AVFORMAT_INCLUDE_DIR)
mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR) mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR)
check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H) check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H)
set(optlibsfound "${optlibsfound} AVFORMAT")
else(AVFORMAT_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} AVFORMAT")
endif(AVFORMAT_LIBRARIES) endif(AVFORMAT_LIBRARIES)
# avcodec (using find_library and find_path) # avcodec (using find_library and find_path)
@ -233,6 +251,9 @@ if(NOT ZM_NO_FFMPEG)
endif(AVCODEC_INCLUDE_DIR) endif(AVCODEC_INCLUDE_DIR)
mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR) mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR)
check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H) check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H)
set(optlibsfound "${optlibsfound} AVCODEC")
else(AVCODEC_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} AVCODEC")
endif(AVCODEC_LIBRARIES) endif(AVCODEC_LIBRARIES)
# avdevice (using find_library and find_path) # avdevice (using find_library and find_path)
@ -247,6 +268,9 @@ if(NOT ZM_NO_FFMPEG)
endif(AVDEVICE_INCLUDE_DIR) endif(AVDEVICE_INCLUDE_DIR)
mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR) mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR)
check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H) check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H)
set(optlibsfound "${optlibsfound} AVDEVICE")
else(AVDEVICE_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} AVDEVICE")
endif(AVDEVICE_LIBRARIES) endif(AVDEVICE_LIBRARIES)
# avutil (using find_library and find_path) # avutil (using find_library and find_path)
@ -262,6 +286,9 @@ if(NOT ZM_NO_FFMPEG)
mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR) mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR)
check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H) check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H)
check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H) check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H)
set(optlibsfound "${optlibsfound} AVUTIL")
else(AVUTIL_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} AVUTIL")
endif(AVUTIL_LIBRARIES) endif(AVUTIL_LIBRARIES)
# swscale (using find_library and find_path) # swscale (using find_library and find_path)
@ -276,6 +303,9 @@ if(NOT ZM_NO_FFMPEG)
endif(SWSCALE_INCLUDE_DIR) endif(SWSCALE_INCLUDE_DIR)
mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR) mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR)
check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H) check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H)
set(optlibsfound "${optlibsfound} SWSCALE")
else(SWSCALE_LIBRARIES)
set(optlibsnotfound "${optlibsnotfound} SWSCALE")
endif(SWSCALE_LIBRARIES) endif(SWSCALE_LIBRARIES)
endif(NOT ZM_NO_FFMPEG) endif(NOT ZM_NO_FFMPEG)
@ -406,6 +436,10 @@ add_subdirectory(db)
add_subdirectory(misc) add_subdirectory(misc)
add_subdirectory(web) add_subdirectory(web)
# Print optional libraries detection status
message(STATUS "Optional libraries found:${optlibsfound}")
message(STATUS "Optional libraries not found:${optlibsnotfound}")
# Run ZM configuration generator # Run ZM configuration generator
message(STATUS "Running ZoneMinder configuration generator") message(STATUS "Running ZoneMinder configuration generator")
execute_process(COMMAND perl ./zmconfgen.pl RESULT_VARIABLE zmconfgen_result) execute_process(COMMAND perl ./zmconfgen.pl RESULT_VARIABLE zmconfgen_result)