GettextCMakeLists.txt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. cmake_minimum_required(VERSION 2.8.12)
  2. project(gettext C)
  3. # Adds PREFIX to each item in LIST
  4. macro(PREFIX_LIST_ITEMS LIST PREFIX)
  5. string(REPLACE ";" ";${PREFIX}" ${LIST} ";${${LIST}}")
  6. endmacro()
  7. file(READ gettext-runtime/config.h.in CONFIG_CONTENT)
  8. string(REPLACE "#undef HAVE_GETCWD" "#define HAVE_GETCWD 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  9. string(REPLACE "#undef HAVE_LONG_LONG_INT" "#define HAVE_LONG_LONG_INT 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  10. string(REPLACE "#undef HAVE_ICONV_H" "#define HAVE_ICONV_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  11. string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  12. string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT ${CONFIG_CONTENT})
  13. string(REPLACE "#undef uintmax_t" "
  14. #if _WIN64
  15. # define intmax_t long long
  16. # define uintmax_t unsigned long long
  17. #elif _WIN32
  18. # define intmax_t long
  19. # define uintmax_t unsigned long
  20. #endif"
  21. CONFIG_CONTENT ${CONFIG_CONTENT})
  22. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/config.h ${CONFIG_CONTENT})
  23. set(HAVE_NEWLOCALE 0)
  24. set(HAVE_POSIX_PRINTF 0)
  25. set(HAVE_SNPRINTF 0)
  26. set(HAVE_ASPRINTF 0)
  27. set(HAVE_WPRINTF 0)
  28. set(HAVE_NAMELESS_LOCALES 0)
  29. set(HAVE_LONG_LONG_INT 1)
  30. configure_file(gettext-runtime/intl/libgnuintl.in.h
  31. ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl/libgnuintl.h)
  32. set(LOCALDIR "gettext")
  33. set(LIBDIR "gettext")
  34. set(PKGDATADIR "gettext")
  35. set(PACKAGE_SUFFIX "gettext")
  36. add_definitions(-DLOCALEDIR=\"${LOCALDIR}\"
  37. -DLOCALE_ALIAS_PATH=\"${LOCALDIR}\"
  38. -DLIBDIR=\"${LOCALDIR}\"
  39. -DINSTALLDIR=\"${LOCALDIR}\"
  40. -DEXEEXT=\".exe\"
  41. -DLOCALEDIR=\"${LOCALDIR}\"
  42. -DLIBDIR=\"${LIBDIR}\"
  43. -DPACKAGE_SUFFIX=\"${PACKAGE_SUFFIX}\"
  44. -DGETTEXTDATADIR=\"${PKGDATADIR}\"
  45. -DBISON_LOCALEDIR=\"${LOCALDIR}\"
  46. -DHAVE_CONFIG_H)
  47. set(libintl_SOURCES
  48. bindtextdom.c dcgettext.c dcigettext.c dcngettext.c dgettext.c dngettext.c
  49. explodename.c finddomain.c gettext.c hash-string.c intl-compat.c l10nflist.c
  50. langprefs.c loadmsgcat.c localcharset.c localealias.c localename-table.c
  51. localename.c lock.c log.c ngettext.c osdep.c
  52. plural-exp.c plural.c printf.c relocatable.c setlocale.c textdomain.c
  53. threadlib.c version.c xsize.c)
  54. PREFIX_LIST_ITEMS(libintl_SOURCES "gettext-runtime/intl/")
  55. add_library(libintl ${libintl_SOURCES})
  56. target_link_libraries(libintl ${LIBICONV_LIBRARIES})
  57. set_property(TARGET libintl APPEND PROPERTY INCLUDE_DIRECTORIES
  58. ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime
  59. ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl
  60. ${LIBICONV_INCLUDE_DIRS})
  61. set_property(TARGET libintl APPEND PROPERTY COMPILE_DEFINITIONS
  62. BUILDING_LIBINTL
  63. IN_LIBINTL
  64. ENABLE_RELOCATABLE=1
  65. IN_LIBRARY
  66. NO_XMALLOC
  67. set_relocation_prefix=libintl_set_relocation_prefix
  68. relocate=libintl_relocate
  69. HAVE_CONFIG_H
  70. _CRT_SECURE_NO_WARNINGS)
  71. file(READ gettext-tools/config.h.in CONFIG_CONTENT)
  72. string(REPLACE "#undef FLEXIBLE_ARRAY_MEMBER" "#define FLEXIBLE_ARRAY_MEMBER 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  73. string(REPLACE "__declspec (dllimport)" "" CONFIG_CONTENT ${CONFIG_CONTENT})
  74. string(REPLACE "#undef ENDIANNESS" "#define ENDIANNESS 0" CONFIG_CONTENT ${CONFIG_CONTENT})
  75. string(REPLACE "#undef GNULIB_FWRITEERROR" "#define GNULIB_FWRITEERROR 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  76. string(REPLACE "#undef HAVE_DECL_STRERROR_R" "#define HAVE_DECL_STRERROR_R 0" CONFIG_CONTENT ${CONFIG_CONTENT})
  77. string(REPLACE "#undef HAVE_DUP2" "#define HAVE_DUP2 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  78. string(REPLACE "#undef HAVE_ICONV_H" "#define HAVE_ICONV_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  79. string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  80. string(REPLACE "#undef HAVE_LIBUNISTRING" "#define HAVE_LIBUNISTRING 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  81. string(REPLACE "#undef HAVE_STDINT_H_WITH_UINTMAX" "#define HAVE_STDINT_H_WITH_UINTMAX 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  82. string(REPLACE "#undef HAVE_STDINT_H" "#define HAVE_STDINT_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  83. string(REPLACE "#undef HAVE_LONG_LONG_INT" "#define HAVE_LONG_LONG_INT 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  84. string(REPLACE "#undef HAVE_STRING_H" "#define HAVE_STRING_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  85. string(REPLACE "#undef HAVE_SYS_TIMEB_H" "#define HAVE_SYS_TIMEB_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  86. string(REPLACE "#undef HAVE__FTIME" "#define HAVE__FTIME 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  87. string(REPLACE "#undef HAVE_FLOAT_H" "#define HAVE_FLOAT_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  88. string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT ${CONFIG_CONTENT})
  89. string(REPLACE "#undef PACKAGE" "#define PACKAGE \"gettext\"\n#define gettext_VERSION" CONFIG_CONTENT ${CONFIG_CONTENT})
  90. string(REPLACE "#undef VERSION" "#define VERSION \"\"" CONFIG_CONTENT ${CONFIG_CONTENT})
  91. string(REPLACE "#undef mode_t" "#define mode_t int" CONFIG_CONTENT ${CONFIG_CONTENT})
  92. string(REPLACE "#undef pid_t" "#define pid_t int" CONFIG_CONTENT ${CONFIG_CONTENT})
  93. string(REPLACE "#undef restrict" "#define restrict __restrict" CONFIG_CONTENT ${CONFIG_CONTENT})
  94. string(REPLACE "#undef ssize_t" "#include <BaseTsd.h>\n#define ssize_t SSIZE_T" CONFIG_CONTENT ${CONFIG_CONTENT})
  95. string(REPLACE "#undef uid_t" "#define uid_t int" CONFIG_CONTENT ${CONFIG_CONTENT})
  96. string(REPLACE "#undef HAVE_DECL___ARGV" "#define HAVE_DECL___ARGV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  97. set(CONFIG_CONTENT "${CONFIG_CONTENT}\n#define isatty libtextstyle_isatty")
  98. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-tools/config.h ${CONFIG_CONTENT})
  99. set(libgettextsrc_COMMON_SOURCE
  100. message.c po-error.c po-xerror.c read-catalog-abstract.c po-lex.c
  101. po-gram-gen.c po-charset.c read-po.c read-properties.c read-stringtable.c
  102. open-catalog.c dir-list.c str-list.c)
  103. set(libgettextsrc_FORMAT_SOURCE
  104. format.c format-invalid.h format-c.c format-c-parse.h format-sh.c
  105. format-python.c format-python-brace.c format-lisp.c format-elisp.c
  106. format-librep.c format-scheme.c format-java.c format-csharp.c format-awk.c
  107. format-pascal.c format-ycp.c format-tcl.c format-perl.c format-perl-brace.c
  108. format-php.c format-gcc-internal.c format-gfc-internal.c format-qt.c
  109. format-qt-plural.c format-kde.c format-kde-kuit.c format-boost.c format-lua.c
  110. format-javascript.c)
  111. set(libgettextsrc_SOURCES
  112. ${libgettextsrc_COMMON_SOURCE} read-catalog.c
  113. write-catalog.c write-properties.c write-stringtable.c write-po.c
  114. msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c
  115. msgl-check.c file-list.c msgl-charset.c po-time.c plural-exp.c plural-eval.c
  116. plural-table.c quote.h sentence.h sentence.c
  117. ${libgettextsrc_FORMAT_SOURCE}
  118. read-desktop.c locating-rule.c its.c search-path.c)
  119. PREFIX_LIST_ITEMS(libgettextsrc_SOURCES "gettext-tools/src/")
  120. set(GLIBC_SOURCE
  121. uniname/uniname.c javaexec.c unsetenv.c classpath.c setenv.c xsetenv.c
  122. sh-quote.c execute.c javaversion.c csharpcomp.c csharpexec.c javacomp.c
  123. gettimeofday.c getdtablesize.c fcntl.c dup-safer-flag.c cloexec.c
  124. fd-safer-flag.c fd-safer.c pipe2.c pipe2-safer.c spawn-pipe.c xmemdup0.c
  125. secure_getenv.c tmpdir.c tempname.c mkdtemp.c fnmatch.c clean-temp.c
  126. wait-process.c waitpid.c getdelim.c getline.c sigprocmask.c sigaction.c
  127. addext.c argmatch.c backupfile.c basename.c c-strcasecmp.c c-strncasecmp.c
  128. c-strstr.c closeout.c concat-filename.c error-progname.c error.c exitfail.c
  129. fstrcmp.c full-write.c fwriteerror.c getopt.c getopt1.c hash.c libxml/buf.c
  130. localcharset.c malloca.c mbchar.c mbslen.c mbsstr.c mbswidth.c obstack.c
  131. progname.c printf-args.c printf-parse.c propername.c quotearg.c rawmemchr.c
  132. safe-read.c safe-write.c stpcpy.c stpncpy.c strchrnul.c striconv.c
  133. striconveh.c striconveha.c strnlen1.c trim.c gcd.c gl_linkedhash_list.c
  134. uniconv/u8-conv-from-enc.c unictype/ctype_space.c unilbrk/lbrktables.c
  135. unilbrk/u8-possible-linebreaks.c unilbrk/u8-width-linebreaks.c
  136. unilbrk/ulc-common.c unilbrk/ulc-width-linebreaks.c unistr/u16-mbtouc-aux.c
  137. unistr/u16-mbtouc.c unistr/u8-check.c unistr/u8-mblen.c
  138. unistr/u8-mbtouc-aux.c unistr/u8-mbtouc-unsafe-aux.c
  139. unistr/u8-mbtouc-unsafe.c unistr/u8-mbtouc.c unistr/u8-mbtoucr.c
  140. unistr/u8-prev.c unistr/u8-uctomb-aux.c unistr/u8-uctomb.c uniwidth/width.c
  141. vasnprintf.c vasprintf.c wcwidth.c xasprintf.c xconcat-filename.c xerror.c
  142. xmalloc.c xstrdup.c xstriconv.c xstriconveh.c xvasprintf.c
  143. libxml/DOCBparser.c libxml/HTMLparser.c libxml/HTMLtree.c libxml/SAX.c
  144. libxml/SAX2.c libxml/c14n.c libxml/catalog.c libxml/chvalid.c
  145. libxml/debugXML.c libxml/dict.c libxml/encoding.c libxml/entities.c
  146. libxml/error.c libxml/globals.c libxml/hash.c libxml/legacy.c libxml/list.c
  147. libxml/nanoftp.c libxml/nanohttp.c libxml/parser.c libxml/parserInternals.c
  148. libxml/pattern.c libxml/relaxng.c libxml/schematron.c libxml/threads.c
  149. libxml/tree.c libxml/trionan.c libxml/uri.c libxml/valid.c libxml/xinclude.c
  150. libxml/xlink.c libxml/xmlIO.c libxml/xmlmemory.c libxml/xmlmodule.c
  151. libxml/xmlreader.c libxml/xmlregexp.c libxml/xmlsave.c libxml/xmlschemas.c
  152. libxml/xmlschemastypes.c libxml/xmlstring.c libxml/xmlunicode.c
  153. libxml/xmlwriter.c libxml/xpath.c libxml/xpointer.c fatal-signal.c
  154. copy-file.c read-file.c ftello.c utime.c gettime.c utimens.c)
  155. PREFIX_LIST_ITEMS(GLIBC_SOURCE "gettext-tools/gnulib-lib/")
  156. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-tools/gnulib-lib/configmake.h "#define PKGDATADIR \"gettext\"")
  157. set(LIBGLIB_SOURCES
  158. ghash.c glist.c gmessages.c gprimes.c gstrfuncs.c gstring.c)
  159. PREFIX_LIST_ITEMS(LIBGLIB_SOURCES "libtextstyle/lib/glib/")
  160. set(LIBTEXTSTYLE_SOURCE
  161. gl_array_list.h gl_array_list.c binary-io.h
  162. binary-io.c c-ctype.h c-ctype.c c-strcase.h c-strcasecmp.c
  163. c-strncasecmp.c concat-filename.c dirname-lgpl.c
  164. basename-lgpl.c stripslash.c exitfail.c fatal-signal.h
  165. fatal-signal.c fd-hook.c fd-ostream.c file-ostream.c
  166. full-write.h full-write.c getprogname.h getprogname.c
  167. gettext.h hash.h hash.c html-ostream.c html-styled-ostream.c
  168. iconv-ostream.c gl_list.h gl_list.c math.c memory-ostream.c
  169. minmax.h noop-styled-ostream.c ostream.c safe-read.c
  170. safe-write.c sig-handler.c size_max.h styled-ostream.c
  171. term-ostream.c term-style-control.c term-styled-ostream.c
  172. unistd.c xalloc.h xmalloc.c xstrdup.c
  173. xconcat-filename.c gl_xlist.h gl_xlist.c xsize.h xsize.c
  174. xvasprintf.h xvasprintf.c xasprintf.c color.h color.c misc.h
  175. misc.c version.c isatty.c fsync.c tparm.c tputs.c)
  176. PREFIX_LIST_ITEMS(LIBTEXTSTYLE_SOURCE "libtextstyle/lib/")
  177. configure_file(
  178. libtextstyle/lib/stdbool.mini.h
  179. ${CMAKE_CURRENT_BINARY_DIR}/libtextstyle/lib/textstyle/stdbool.h
  180. COPYONLY)
  181. set(LIBCROCO_SOURCES
  182. cr-additional-sel.c cr-attr-sel.c cr-cascade.c cr-declaration.c
  183. cr-doc-handler.c cr-enc-handler.c cr-fonts.c cr-input.c cr-num.c
  184. cr-om-parser.c cr-parser.c cr-parsing-location.c cr-prop-list.c cr-pseudo.c
  185. cr-rgb.c cr-sel-eng.c cr-selector.c cr-simple-sel.c cr-statement.c
  186. cr-string.c cr-style.c cr-stylesheet.c cr-term.c cr-tknzr.c cr-token.c
  187. cr-utils.c)
  188. PREFIX_LIST_ITEMS(LIBCROCO_SOURCES "libtextstyle/lib/libcroco/")
  189. set(libgettextsrc_SOURCES
  190. ${libgettextsrc_SOURCES} ${GLIBC_SOURCE} ${LIBGLIB_SOURCES}
  191. ${LIBTEXTSTYLE_SOURCE} ${LIBCROCO_SOURCES})
  192. macro(CONFIGURE_HEADER_FILES HEADER_TEMPLATES_PATH)
  193. set(HEADER_TEMPLATES_ABS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_TEMPLATES_PATH}")
  194. file(GLOB_RECURSE HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/*.in.h")
  195. list(REMOVE_ITEM HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/stdint.in.h")
  196. list(REMOVE_ITEM HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/wchar.in.h")
  197. foreach(HEADER_TEMPLATE ${HEADER_TEMPLATES})
  198. file(READ ${HEADER_TEMPLATE} HEADER_CONTENT)
  199. string(REPLACE "/* The definition of _GL_ARG_NONNULL is copied here. */" "#include \"arg-nonnull.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
  200. string(REPLACE "/* The definition of _GL_WARN_ON_USE is copied here. */" "#include \"warn-on-use.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
  201. string(REPLACE "/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */" "#include \"c++defs.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
  202. string(REPLACE "@GNULIB_LSTAT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  203. string(REPLACE "@GNULIB_MBSINIT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  204. string(REPLACE "@GNULIB_SIGACTION@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  205. string(REPLACE "@GNULIB_SIGPROCMASK@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  206. string(REPLACE "@GNULIB_STPCPY@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  207. string(REPLACE "@GNULIB_STPNCPY@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  208. string(REPLACE "@GNULIB_STRCHRNUL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  209. string(REPLACE "@HAVE_ISWCNTRL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  210. string(REPLACE "@HAVE_WCTYPE_T@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  211. string(REPLACE "@HAVE_STRUCT_TIMEVAL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  212. string(REPLACE "@HAVE_WINSOCK2_H@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  213. string(REPLACE "@DLL_VARIABLE@" "" HEADER_CONTENT "${HEADER_CONTENT}")
  214. string(REPLACE "@HAVE_NEWLOCALE@" "0" HEADER_CONTENT "${HEADER_CONTENT}")
  215. string(REPLACE "@PRAGMA_COLUMNS@" "" HEADER_CONTENT "${HEADER_CONTENT}")
  216. string(REPLACE "#if @GNULIB_UTIME@" "#if 1\n#define utime gl_utime" HEADER_CONTENT "${HEADER_CONTENT}")
  217. string(REPLACE "@HAVE_UTIME@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  218. string(REPLACE "@HAVE_LONG_LONG_INT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
  219. string(REGEX REPLACE "^${HEADER_TEMPLATES_ABS_PATH}/" "" HEADER_PATH "${HEADER_TEMPLATE}")
  220. string(REPLACE ".in" "" HEADER_PATH ${HEADER_PATH})
  221. string(REPLACE "_" "/" HEADER_PATH ${HEADER_PATH})
  222. # find_file will create a cache entry for the variable
  223. # SYSTEM_HEADER, so reset it before each call
  224. set(SYSTEM_HEADER "SYSTEM_HEADER-NOTFOUND")
  225. find_file(SYSTEM_HEADER ${HEADER_PATH} PATHS "${LIBICONV_INCLUDE_DIRS}")
  226. if(SYSTEM_HEADER)
  227. # Gnulib uses #include_next to extend system header files,
  228. # but MSVC doesn't support it, so a regular include directive
  229. # with a relative path is used instead
  230. string(REGEX REPLACE ".*/(.*/${HEADER_PATH})" "../\\1"
  231. INCLUDE_PATH "${SYSTEM_HEADER}")
  232. string(REGEX REPLACE "@INCLUDE_NEXT[^@]*@ @NEXT_[^@\n]+@"
  233. "include <${INCLUDE_PATH}>" HEADER_CONTENT "${HEADER_CONTENT}")
  234. endif()
  235. # Default any remaining template variables to 0
  236. string(REGEX REPLACE "@[^@\n]+@" "0" HEADER_CONTENT "${HEADER_CONTENT}")
  237. file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_TEMPLATES_PATH}/${HEADER_PATH}" "${HEADER_CONTENT}")
  238. endforeach()
  239. endmacro()
  240. CONFIGURE_HEADER_FILES("gettext-tools/gnulib-lib")
  241. CONFIGURE_HEADER_FILES("libtextstyle/lib")
  242. add_library(libgettextsrc ${libgettextsrc_SOURCES})
  243. target_link_libraries(libgettextsrc ${LIBICONV_LIBRARIES})
  244. set_property(TARGET libgettextsrc APPEND PROPERTY COMPILE_DEFINITIONS
  245. LIBTEXTSTYLE_DLL_VARIABLE=)
  246. set(msgmerge_SOURCES
  247. msgmerge.c msgl-fsearch.c lang-table.c plural-count.c)
  248. PREFIX_LIST_ITEMS(msgmerge_SOURCES "gettext-tools/src/")
  249. add_executable(msgmerge ${msgmerge_SOURCES})
  250. target_link_libraries(msgmerge libgettextsrc)
  251. add_dependencies(msgmerge libgettextsrc libintl)
  252. set(msgfmt_SOURCES
  253. msgfmt.c write-mo.c write-java.c write-csharp.c write-resources.c write-tcl.c
  254. write-qt.c write-desktop.c write-xml.c
  255. ../../gettext-runtime/intl/hash-string.c)
  256. PREFIX_LIST_ITEMS(msgfmt_SOURCES "gettext-tools/src/")
  257. add_executable(msgfmt ${msgfmt_SOURCES})
  258. target_link_libraries(msgfmt libgettextsrc)
  259. add_dependencies(msgfmt libgettextsrc libintl)
  260. set(xgettext_SOURCES
  261. xgettext.c xg-pos.c xg-encoding.c xg-mixed-string.c xg-arglist-context.c
  262. xg-arglist-callshape.c xg-arglist-parser.c xg-message.c x-c.c x-po.c x-sh.c
  263. x-python.c x-lisp.c x-elisp.c x-librep.c x-scheme.c x-smalltalk.c x-java.c
  264. x-csharp.c x-awk.c x-ycp.c x-tcl.c x-perl.c x-php.c x-rst.c x-lua.c
  265. x-javascript.c x-vala.c x-desktop.c)
  266. PREFIX_LIST_ITEMS(xgettext_SOURCES "gettext-tools/src/")
  267. add_executable(xgettext ${xgettext_SOURCES})
  268. target_link_libraries(xgettext libgettextsrc)
  269. add_dependencies(xgettext libgettextsrc libintl)
  270. set_property(TARGET msgmerge msgfmt xgettext libgettextsrc APPEND PROPERTY
  271. INCLUDE_DIRECTORIES
  272. ${CMAKE_CURRENT_SOURCE_DIR}/gettext-runtime/intl
  273. ${CMAKE_CURRENT_SOURCE_DIR}/gettext-tools/libgettextpo
  274. ${CMAKE_CURRENT_SOURCE_DIR}/gettext-tools/gnulib-lib
  275. ${CMAKE_CURRENT_SOURCE_DIR}/gettext-tools/gnulib-lib/libcroco
  276. ${CMAKE_CURRENT_SOURCE_DIR}/build-aux/snippet
  277. ${CMAKE_CURRENT_SOURCE_DIR}/libtextstyle/lib
  278. ${CMAKE_CURRENT_SOURCE_DIR}/libtextstyle/lib/libcroco
  279. ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl
  280. ${CMAKE_CURRENT_BINARY_DIR}/gettext-tools
  281. ${CMAKE_CURRENT_BINARY_DIR}/gettext-tools/gnulib-lib
  282. ${CMAKE_CURRENT_BINARY_DIR}/libtextstyle/lib
  283. ${CMAKE_CURRENT_BINARY_DIR}/libtextstyle/lib/textstyle
  284. ${LIBICONV_INCLUDE_DIRS})
  285. include(GNUInstallDirs)
  286. install(FILES
  287. ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl/libgnuintl.h
  288. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
  289. RENAME libintl.h)
  290. install(TARGETS libintl msgmerge msgfmt xgettext
  291. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  292. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  293. PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
  294. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})