Home Explore Blog CI



neovim

1st chunk of `cmake.deps/cmake/GettextCMakeLists.txt`
704d631bdbc3af2b265e5f653b57863481ed3000f2084a9b0000000100000fa6
cmake_minimum_required(VERSION 3.16)
project(gettext C)

add_compile_options(-w)
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4006")

# Adds PREFIX to each item in LIST
macro(PREFIX_LIST_ITEMS LIST PREFIX)
  string(REPLACE ";" ";${PREFIX}" ${LIST} ";${${LIST}}")
endmacro()

file(READ gettext-runtime/config.h.in CONFIG_CONTENT)
string(REPLACE "#undef HAVE_GETCWD" "#define HAVE_GETCWD 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_LONG_LONG_INT" "#define HAVE_LONG_LONG_INT 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_ICONV_H" "#define HAVE_ICONV_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT ${CONFIG_CONTENT})
if(MSVC)
  string(REPLACE "#undef HAVE_STDINT_H_WITH_UINTMAX" "#define HAVE_STDINT_H_WITH_UINTMAX 1" CONFIG_CONTENT ${CONFIG_CONTENT})
  string(REPLACE "#undef HAVE_STDINT_H" "#define HAVE_STDINT_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
else()
  string(REPLACE "#undef uintmax_t" "
    #if _WIN64
    # define intmax_t long long
    # define uintmax_t unsigned long long
    #elif _WIN32
    # define intmax_t long
    # define uintmax_t unsigned long
    #endif"
    CONFIG_CONTENT ${CONFIG_CONTENT})
  endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/config.h ${CONFIG_CONTENT})

set(HAVE_NEWLOCALE 0)
set(HAVE_POSIX_PRINTF 0)
set(HAVE_SNPRINTF 0)
set(HAVE_ASPRINTF 0)
set(HAVE_WPRINTF 0)
set(HAVE_NAMELESS_LOCALES 0)
set(HAVE_LONG_LONG_INT 1)
configure_file(gettext-runtime/intl/libgnuintl.in.h
  ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl/libgnuintl.h)

set(LOCALDIR "gettext")
set(LIBDIR "gettext")
set(PKGDATADIR "gettext")
set(PACKAGE_SUFFIX "gettext")
add_definitions(-DLOCALEDIR=\"${LOCALDIR}\"
  -DLOCALE_ALIAS_PATH=\"${LOCALDIR}\"
  -DLIBDIR=\"${LOCALDIR}\"
  -DINSTALLDIR=\"${LOCALDIR}\"
  -DEXEEXT=\".exe\"
  -DLOCALEDIR=\"${LOCALDIR}\"
  -DLIBDIR=\"${LIBDIR}\"
  -DPACKAGE_SUFFIX=\"${PACKAGE_SUFFIX}\"
  -DGETTEXTDATADIR=\"${PKGDATADIR}\"
  -DBISON_LOCALEDIR=\"${LOCALDIR}\"
  -DHAVE_CONFIG_H)

set(libintl_SOURCES
  bindtextdom.c dcgettext.c dcigettext.c dcngettext.c dgettext.c dngettext.c
  explodename.c finddomain.c gettext.c hash-string.c intl-compat.c l10nflist.c
  langprefs.c loadmsgcat.c localcharset.c localealias.c localename-table.c
  localename.c lock.c log.c ngettext.c osdep.c
  plural-exp.c plural.c printf.c relocatable.c setlocale.c textdomain.c
  threadlib.c version.c xsize.c)

PREFIX_LIST_ITEMS(libintl_SOURCES "gettext-runtime/intl/")

add_library(libintl ${libintl_SOURCES})
target_link_libraries(libintl ${LIBICONV_LIBRARIES})
set_property(TARGET libintl APPEND PROPERTY INCLUDE_DIRECTORIES
  ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime
  ${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl
  ${LIBICONV_INCLUDE_DIRS})
set_property(TARGET libintl APPEND PROPERTY COMPILE_DEFINITIONS
  BUILDING_LIBINTL
  IN_LIBINTL
  ENABLE_RELOCATABLE=1
  IN_LIBRARY
  NO_XMALLOC
  set_relocation_prefix=libintl_set_relocation_prefix
  relocate=libintl_relocate
  HAVE_CONFIG_H)


file(READ gettext-tools/config.h.in CONFIG_CONTENT)
string(REPLACE "#undef FLEXIBLE_ARRAY_MEMBER" "#define FLEXIBLE_ARRAY_MEMBER 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "__declspec (dllimport)" "" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef ENDIANNESS" "#define ENDIANNESS 0" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef GNULIB_FWRITEERROR" "#define GNULIB_FWRITEERROR 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_DECL_STRERROR_R" "#define HAVE_DECL_STRERROR_R 0" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_DUP2" "#define HAVE_DUP2 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_ICONV_H" "#define HAVE_ICONV_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE

Title: CMake Configuration for Gettext Library and Tools
Summary
This CMake script configures the build process for the gettext library and tools. It sets compiler options, defines macros, configures header files, specifies source files for the libintl library, and defines properties such as include directories and compile definitions. It also configures the config.h file for gettext tools.