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 df01036c3f7ec745f439366494e8810080424e56
This commit is contained in:
mckaygerhard 2021-11-22 01:08:13 -04:00
parent 7336cbdfe2
commit 1fea9f2e10

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)
@ -587,6 +595,7 @@ if(BUILD_CLIENT)
${PNG_LIBRARIES}
${X11_LIBRARIES}
${GETTEXT_LIBRARY}
${Intl_LIBRARIES}
${SOUND_LIBRARIES}
${SQLITE3_LIBRARY}
${LUA_LIBRARY}
@ -652,6 +661,7 @@ if(BUILD_SERVER)
${SQLITE3_LIBRARY}
${JSON_LIBRARY}
${GETTEXT_LIBRARY}
${Intl_LIBRARIES}
${LUA_LIBRARY}
${GMP_LIBRARY}
${PLATFORM_LIBS}