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()