From fb8401098e91dc6b553cdefc6afdfca954a6ea09 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Fri, 31 May 2024 23:41:40 -0400 Subject: [PATCH] CMake: link with Intl when necessary * On some platforms, such as Linux with GNU libc, the gettext functions are present in the C standard library and libintl is not required. For other libc (uClibc-ng or musl) libintl may be required. Thanks Debian the mother of all distros! * close https://github.com/minetest/minetest/issues/8583 * fixed https://github.com/minetest/minetest/issues/8588 --- src/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1be05a8be..3add8909f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -84,6 +84,14 @@ if(ENABLE_GETTEXT) endif() set(USE_GETTEXT TRUE) message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}") + # On some platforms, such as Linux with GNU libc, the gettext + # functions are present in the C standard library and libintl + # is not required. For other libc (uClibc-ng or musl) libintl + # may be required. + find_package(Intl) + if(NOT Intl_LIBRARIES STREQUAL "") + message(STATUS "GetText Intl : ${Intl_LIBRARIES}") + endif() endif(GETTEXTLIB_FOUND) else() mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT) @@ -575,6 +583,7 @@ if(BUILD_CLIENT) ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${X11_LIBRARIES} + ${Intl_LIBRARIES} ${SOUND_LIBRARIES} ${SQLITE3_LIBRARY} ${LUA_LIBRARY} @@ -684,6 +693,7 @@ if(BUILD_SERVER) ${ZLIB_LIBRARIES} ${SQLITE3_LIBRARY} ${JSON_LIBRARY} + ${Intl_LIBRARIES} ${LUA_LIBRARY} ${GMP_LIBRARY} ${PLATFORM_LIBS}