t - modified minetest for gpcfs purposes
aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/FindGettextLib.cmake
blob: 5779b6b6479324f247106fb713964d9d73288d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Package finder for gettext libs and include files

SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
	CACHE FILEPATH "path to custom gettext")

# by default
SET(GETTEXT_FOUND FALSE)

FIND_PATH(GETTEXT_INCLUDE_DIR
	NAMES libintl.h
	PATHS "${CUSTOM_GETTEXT_PATH}/include"
	DOC "gettext include directory")

FIND_PROGRAM(GETTEXT_MSGFMT
	NAMES msgfmt
	PATHS "${CUSTOM_GETTEXT_PATH}/bin"
	DOC "path to msgfmt")

# modern Linux, as well as Mac, seem to not need require special linking
# they do not 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)
	ELSE()
		SET(GETTEXT_LIB_NAMES
			libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
	ENDIF()
	FIND_LIBRARY(GETTEXT_LIBRARY
		NAMES ${GETTEXT_LIB_NAMES}
		PATHS "${CUSTOM_GETTEXT_PATH}/lib"
		DOC "gettext *intl*.lib")
	FIND_FILE(GETTEXT_DLL
		NAMES libintl.dll intl.dll libintl3.dll intl3.dll
		PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" 
		DOC "gettext *intl*.dll")
	FIND_FILE(GETTEXT_ICONV_DLL
		NAMES libiconv2.dll
		PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
		DOC "gettext *iconv*.lib")
ENDIF(WIN32)

IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT)
	IF (WIN32)
		# in the Win32 case check also for the extra linking requirements
		IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL)
			SET(GETTEXT_FOUND TRUE)
		ENDIF()
	ELSE(WIN32)
		# *BSD variants require special linkage as they don't use glibc
		IF(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
			SET(GETTEXT_LIBRARY "intl")
		ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
		SET(GETTEXT_FOUND TRUE)
	ENDIF(WIN32)
ENDIF()

IF(GETTEXT_FOUND)