diff options
author | DRC <dcommander@users.sourceforge.net> | 2011-06-24 04:17:02 +0000 |
---|---|---|
committer | DRC <dcommander@users.sourceforge.net> | 2011-06-24 04:17:02 +0000 |
commit | 2690f7ae11eda4ec329839c6f02e2799465d0f13 (patch) | |
tree | 92ad33d2f56a802832178ca3a1140829e42d5147 /CMakeLists.txt | |
parent | 305937332a0e82fa19314dfa143cf4b9c056c511 (diff) | |
download | tigervnc-2690f7ae11eda4ec329839c6f02e2799465d0f13.tar.gz tigervnc-2690f7ae11eda4ec329839c6f02e2799465d0f13.zip |
Automatically disable NLS if gettext and/or libiconv are missing. On some platforms, such as Windows and OS X, NLS can't be enabled without a lot of custom configuration, so the build simply fails on those platforms unless -DENABLE_NLS=0 is specified. This change makes the CMake system behave more like autotools used to, and it is consistent with the detection behavior of other non-essential modules, such as GnuTLS.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4531 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ace5ffa3..b4047daa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,34 +135,37 @@ endif() option(ENABLE_NLS "Enable translation of program messages" ON) if(ENABLE_NLS) # Tools - find_package(Gettext REQUIRED) + find_package(Gettext) set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale") # Gettext needs iconv - find_package(Iconv REQUIRED) - - # Headers and libraries (copied from licq) - set(GETTEXT_FOUND FALSE) - - find_path(GETTEXT_INCLUDE_DIR libintl.h) - if(GETTEXT_INCLUDE_DIR) - set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) - check_function_exists(dgettext LIBC_HAS_DGETTEXT) - if(LIBC_HAS_DGETTEXT) - set(GETTEXT_FOUND TRUE) - else() - find_library(LIBINTL_LIBRARY NAMES intl libintl) - check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) - if(LIBINTL_HAS_DGETTEXT) - set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY} ${ICONV_LIBRARIES}) + find_package(Iconv) + + if(ICONV_FOUND) + # Headers and libraries (copied from licq) + set(GETTEXT_FOUND FALSE) + + find_path(GETTEXT_INCLUDE_DIR libintl.h) + if(GETTEXT_INCLUDE_DIR) + set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) + check_function_exists(dgettext LIBC_HAS_DGETTEXT) + if(LIBC_HAS_DGETTEXT) set(GETTEXT_FOUND TRUE) + else() + find_library(LIBINTL_LIBRARY NAMES intl libintl) + check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) + if(LIBINTL_HAS_DGETTEXT) + set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY} ${ICONV_LIBRARIES}) + set(GETTEXT_FOUND TRUE) + endif() endif() + set(CMAKE_REQUIRED_LIBRARIES) endif() - set(CMAKE_REQUIRED_LIBRARIES) endif() if(NOT GETTEXT_FOUND) - message(FATAL_ERROR "Gettext NOT found") + message(WARNING "Gettext NOT found. Native Language Support disabled.") + set(ENABLE_NLS 0) endif() endif() |