diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-10-15 14:58:26 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-10-15 14:58:26 +0200 |
commit | 1d6e1fd75272b0d1799c453b16a1b73500452974 (patch) | |
tree | f2d6178117485f249e3ec1f1fe5b53fc849f7039 /cmake | |
parent | 18b3c7a30b817bbb235e0a6c82e2299144acd3db (diff) | |
download | weechat-1d6e1fd75272b0d1799c453b16a1b73500452974.zip |
core: make libintl.h required if CMake option ENABLE_NLS is enabled (issue #2031)
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindGettext.cmake | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake index 358734688..2460e190b 100644 --- a/cmake/FindGettext.cmake +++ b/cmake/FindGettext.cmake @@ -45,26 +45,28 @@ set(CMAKE_REQUIRED_INCLUDES ${LIBINTL_INCLUDE}) check_include_files(libintl.h HAVE_LIBINTL_H) -if(HAVE_LIBINTL_H) - check_function_exists(dgettext LIBC_HAS_DGETTEXT) - if(LIBC_HAS_DGETTEXT) - set(GETTEXT_FOUND TRUE) - else() - find_library(LIBINTL_LIBRARY NAMES intl - PATHS - /usr/local/lib - /usr/lib - ) - if(LIBINTL_LIBRARY) - if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") - set(CMAKE_REQUIRED_LIBRARIES "iconv") - check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) - else() - check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) - endif() - if(LIBINTL_HAS_DGETTEXT) - set(GETTEXT_FOUND TRUE) - endif() +if(NOT HAVE_LIBINTL_H) + message(SEND_ERROR "Header libintl.h not found, required if ENABLE_NLS is enabled") +endif() + +check_function_exists(dgettext LIBC_HAS_DGETTEXT) +if(LIBC_HAS_DGETTEXT) + set(GETTEXT_FOUND TRUE) +else() + find_library(LIBINTL_LIBRARY NAMES intl + PATHS + /usr/local/lib + /usr/lib + ) + if(LIBINTL_LIBRARY) + if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") + set(CMAKE_REQUIRED_LIBRARIES "iconv") + check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) + else() + check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) + endif() + if(LIBINTL_HAS_DGETTEXT) + set(GETTEXT_FOUND TRUE) endif() endif() endif() |