CMake: Require libgnutls by default.

- Make cmake complain and abort the build process if libgnutls is not
  available.  In order to build Taskwarrior without "sync" support,
  or to build it on a system with libgnutls missing, the new cmake
  flag "-DENABLE_SYNC=OFF" can be used.
This commit is contained in:
Wilhelm Schuermann 2015-06-22 21:06:28 +02:00
parent 53f7786da5
commit de8eb2814b
3 changed files with 39 additions and 6 deletions

View file

@ -12,7 +12,14 @@ set (HAVE_CMAKE true)
project (task)
set (PROJECT_VERSION "2.4.5")
OPTION(USE_GNUTLS "Build gnutls support." ON)
OPTION (ENABLE_SYNC "Enable 'task sync' support" ON)
if (ENABLE_SYNC)
set (USE_GNUTLS ON CACHE BOOL "Build gnutls support." FORCE)
else (ENABLE_SYNC)
set (USE_GNUTLS OFF CACHE BOOL "Build gnutls support." FORCE)
message (WARNING "ENABLE_SYNC=OFF. Not building sync support.")
endif (ENABLE_SYNC)
message ("CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}")
@ -116,6 +123,10 @@ if (USE_GNUTLS)
endif (GNUTLS_FOUND)
endif (USE_GNUTLS)
if (ENABLE_SYNC AND NOT GNUTLS_FOUND)
message (FATAL_ERROR "Cannot find GnuTLS. Use -DENABLE_SYNC=OFF to build Taskwarrior without sync support. See INSTALL for more information.")
endif (ENABLE_SYNC AND NOT GNUTLS_FOUND)
check_function_exists (timegm HAVE_TIMEGM)
check_function_exists (get_current_dir_name HAVE_GET_CURRENT_DIR_NAME)
check_function_exists (wordexp HAVE_WORDEXP)