mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
parent
af38bae57f
commit
e8ee4cb40d
3 changed files with 26 additions and 50 deletions
|
@ -1,60 +1,36 @@
|
|||
|
||||
set(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
|
||||
CACHE FILEPATH "path to custom gettext")
|
||||
|
||||
find_path(GETTEXT_INCLUDE_DIR
|
||||
NAMES libintl.h
|
||||
PATHS "${CUSTOM_GETTEXT_PATH}/include"
|
||||
DOC "GetText include directory")
|
||||
# This module find everything related to Gettext:
|
||||
# * development tools (msgfmt)
|
||||
# * libintl for runtime usage
|
||||
|
||||
find_program(GETTEXT_MSGFMT
|
||||
NAMES msgfmt
|
||||
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
|
||||
DOC "Path to msgfmt")
|
||||
DOC "Path to Gettext msgfmt")
|
||||
|
||||
set(GETTEXT_REQUIRED_VARS GETTEXT_INCLUDE_DIR GETTEXT_MSGFMT)
|
||||
if(GETTEXT_INCLUDE_DIR AND GETTEXT_LIBRARY)
|
||||
# This is only really used on Windows
|
||||
find_path(GETTEXT_INCLUDE_DIR NAMES libintl.h)
|
||||
find_library(GETTEXT_LIBRARY NAMES intl)
|
||||
|
||||
if(APPLE)
|
||||
find_library(GETTEXT_LIBRARY
|
||||
NAMES libintl.a
|
||||
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
|
||||
DOC "GetText library")
|
||||
set(GETTEXT_REQUIRED_VARS GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
|
||||
else()
|
||||
find_package(Intl)
|
||||
set(GETTEXT_INCLUDE_DIR ${Intl_INCLUDE_DIRS})
|
||||
set(GETTEXT_LIBRARY ${Intl_LIBRARIES})
|
||||
|
||||
find_library(ICONV_LIBRARY
|
||||
NAMES libiconv.dylib
|
||||
PATHS "/usr/lib"
|
||||
DOC "IConv library")
|
||||
set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_LIBRARY ICONV_LIBRARY)
|
||||
endif(APPLE)
|
||||
|
||||
# Modern Linux, as well as OSX, does not require special linking because
|
||||
# GetText is part of glibc.
|
||||
# TODO: check the requirements on other BSDs and older Linux
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
set(GETTEXT_LIB_NAMES
|
||||
libintl.lib intl.lib libintl3.lib intl3.lib)
|
||||
# Because intl may be part of the libc it's valid for the two variables to
|
||||
# be empty, therefore we can't just put them into GETTEXT_REQUIRED_VARS.
|
||||
if(Intl_FOUND)
|
||||
set(GETTEXT_REQUIRED_VARS GETTEXT_MSGFMT)
|
||||
else()
|
||||
set(GETTEXT_LIB_NAMES
|
||||
libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
|
||||
set(GETTEXT_REQUIRED_VARS _LIBINTL_WAS_NOT_FOUND)
|
||||
endif()
|
||||
find_library(GETTEXT_LIBRARY
|
||||
NAMES ${GETTEXT_LIB_NAMES}
|
||||
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
|
||||
DOC "GetText library")
|
||||
endif(WIN32)
|
||||
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GettextLib DEFAULT_MSG ${GETTEXT_REQUIRED_VARS})
|
||||
|
||||
|
||||
if(GETTEXTLIB_FOUND)
|
||||
# BSD variants require special linkage as they don't use glibc
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "BSD|DragonFly")
|
||||
set(GETTEXT_LIBRARY "intl")
|
||||
endif()
|
||||
|
||||
# Set up paths for building
|
||||
set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
|
||||
set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
|
||||
set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue