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
This commit is contained in:
mckaygerhard 2023-01-05 16:00:51 -04:00
parent 88a9023d12
commit 80d97d28d3

View File

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