From 80d97d28d3d9fd7667244f86a12f10b858d09cb7 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 5 Jan 2023 16:00:51 -0400 Subject: [PATCH] CMake: link with Intl when necessary for kfreebsd of non-glibc libs like alpine * non Glibc system linking with Intl library may be needed whenGettext support is enabled. * https://git.alpinelinux.org/aports/tree/community/minetest/0001-CMake-link-with-Intl-when-necessary.patch * Fixes: clientlauncher.cpp:(.text+0xcac): undefined reference to `libintl_gettext' * backported df01036c3f --- src/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6462bb7e0..521b8876c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,6 +70,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(GETTEXT_FOUND) else() mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)