Skip to content

Commit

Permalink
If a feature is explicitly requested via the cmake command line, erro…
Browse files Browse the repository at this point in the history
…r out if necessary libraries are missing and do not silently disable the requested feature.
  • Loading branch information
JoachimFalk committed Dec 17, 2024
1 parent f9bab36 commit 38a9aa0
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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}")
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 38a9aa0

Please sign in to comment.