diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b91d84edf..502110bcbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,8 +141,8 @@ find_package(ZLIB REQUIRED) find_package(Pixman REQUIRED) # Check for gettext -option(ENABLE_NLS "Enable translation of program messages" ON) -if(ENABLE_NLS) +set(ENABLE_NLS CACHE BOOL "Enable translation of program messages") +if(ENABLE_NLS OR ENABLE_NLS STREQUAL "") # Tools find_package(Gettext) @@ -176,13 +176,19 @@ if(ENABLE_NLS) endif() if(NOT GETTEXT_FOUND OR NOT ICONV_FOUND) - message(WARNING "Gettext NOT found. Native Language Support disabled.") - set(ENABLE_NLS 0) + if(ENABLE_NLS OR ENABLE_NLS STREQUAL "") + message(WARNING "Gettext NOT found. Native Language Support disabled.") + set(ENABLE_NLS OFF) + else() + message(FATAL_ERROR "Native Language Support requested, but gettext NOT found!") + endif() + else() + set(ENABLE_NLS ON) endif() endif() -option(ENABLE_H264 "Enable H.264 RFB encoding" ON) -if(ENABLE_H264) +set(ENABLE_H264 CACHE BOOL "Enable H.264 RFB encoding") +if(ENABLE_H264 OR ENABLE_H264 STREQUAL "") if(WIN32) add_definitions("-DHAVE_H264") set(H264_LIBS "WIN") # may be LIBAV in the future @@ -203,9 +209,14 @@ if(ENABLE_H264) add_definitions("-D__STDC_CONSTANT_MACROS") add_definitions("-DHAVE_H264") set(H264_LIBS "LIBAV") + set(ENABLE_H264 ON) else() - set(H264_LIBS "NONE") - message(WARNING "FFMPEG support can't be found") + if(ENABLE_H264 STREQUAL "") + set(H264_LIBS "NONE") + message(WARNING "FFMPEG support can't be found. No H.264 RFB encoding support.") + else() + message(FATAL_ERROR "H.264 RFB encoding support requested, but FFMPEG support can't be found!") + endif() endif() endif() add_definitions("-DH264_${H264_LIBS}") @@ -283,19 +294,33 @@ if(BUILD_VIEWER) endif() # Check for GNUTLS library -option(ENABLE_GNUTLS "Enable protocol encryption and advanced authentication" ON) -if(ENABLE_GNUTLS) +set(ENABLE_GNUTLS CACHE BOOL "Enable protocol encryption and advanced authentication") +if(ENABLE_GNUTLS OR ENABLE_GNUTLS STREQUAL "") find_package(GnuTLS) if (GNUTLS_FOUND) add_definitions("-DHAVE_GNUTLS") + set(ENABLE_GNUTLS ON) + else() + if(ENABLE_GNUTLS STREQUAL "") + message(WARNING "GnuTLS NOT found. SSL support disabled.") + else() + message(FATAL_ERROR "GnuTLS support requested, but library could not be found!") + endif() endif() endif() -option(ENABLE_NETTLE "Enable RSA-AES security types" ON) -if (ENABLE_NETTLE) +set(ENABLE_NETTLE CACHE BOOL "Enable RSA-AES security types") +if(ENABLE_NETTLE OR ENABLE_NETTLE STREQUAL "") find_package(Nettle) if (NETTLE_FOUND) add_definitions("-DHAVE_NETTLE") + set(ENABLE_NETTLE ON) + else() + if(ENABLE_NETTLE STREQUAL "") + message(WARNING "Nettle library NOT found. RSA-AES security types disabled.") + else() + message(FATAL_ERROR "RSA-AES security types requested, but Nettle library could not be found!") + endif() endif() endif()