2018-03-02 09:13:57 +08:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
project(libintl C)
|
|
|
|
|
2018-04-18 07:19:59 +08:00
|
|
|
find_package(unofficial-iconv REQUIRED)
|
2018-03-02 09:13:57 +08:00
|
|
|
|
2018-04-18 07:19:59 +08:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/config .)
|
2018-03-02 09:13:57 +08:00
|
|
|
|
2018-04-18 07:19:59 +08:00
|
|
|
set(CMAKE_STATIC_LIBRARY_PREFIX)
|
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX)
|
2018-03-02 09:13:57 +08:00
|
|
|
|
2018-04-18 07:19:59 +08:00
|
|
|
if(WIN32)
|
|
|
|
set(HAVE_POSIX_PRINTF 0)
|
|
|
|
set(HAVE_SNPRINTF 0)
|
|
|
|
set(HAVE_ASPRINTF 0)
|
|
|
|
set(HAVE_WPRINTF 0)
|
|
|
|
set(HAVE_NEWLOCALE 0)
|
|
|
|
|
|
|
|
configure_file(intl/libgnuintl.win32.h config/libgnuintl.h COPYONLY)
|
|
|
|
configure_file(config.win32.h config/config.h COPYONLY)
|
|
|
|
else()
|
|
|
|
set(HAVE_POSIX_PRINTF 1)
|
|
|
|
set(HAVE_SNPRINTF 1)
|
|
|
|
set(HAVE_ASPRINTF 1)
|
|
|
|
set(HAVE_WPRINTF 1)
|
|
|
|
set(HAVE_NEWLOCALE 1)
|
|
|
|
add_definitions(-DHAVE_NEWLOCALE=1)
|
|
|
|
|
|
|
|
configure_file(intl/libgnuintl.in.h config/libgnuintl.h @ONLY)
|
|
|
|
configure_file(config.win32.h config/config.h COPYONLY)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DISABLE_INSTALL_HEADERS)
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/libgnuintl.h" DESTINATION include RENAME libintl.h)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(READ "${CMAKE_CURRENT_BINARY_DIR}/config/config.h" _contents)
|
2018-03-02 09:13:57 +08:00
|
|
|
if(NOT WIN32)
|
|
|
|
string(REPLACE "/* #undef HAVE_STPCPY */" "#define HAVE_STPCPY 1" _contents "${_contents}")
|
|
|
|
endif()
|
2018-04-18 07:19:59 +08:00
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config/config.h" "${_contents}")
|
2018-03-02 09:13:57 +08:00
|
|
|
|
|
|
|
FILE(GLOB SOURCES
|
2018-04-18 07:19:59 +08:00
|
|
|
"intl/bindtextdom.c"
|
|
|
|
"intl/dcgettext.c"
|
|
|
|
"intl/dcigettext.c"
|
|
|
|
"intl/dcngettext.c"
|
|
|
|
"intl/dgettext.c"
|
|
|
|
"intl/dngettext.c"
|
|
|
|
"intl/explodename.c"
|
|
|
|
"intl/finddomain.c"
|
|
|
|
"intl/gettext.c"
|
|
|
|
"intl/hash-string.c"
|
|
|
|
"intl/intl-compat.c"
|
|
|
|
"intl/l10nflist.c"
|
|
|
|
"intl/langprefs.c"
|
|
|
|
"intl/loadmsgcat.c"
|
|
|
|
"intl/localealias.c"
|
|
|
|
"intl/localename.c"
|
|
|
|
"intl/lock.c"
|
|
|
|
"intl/log.c"
|
|
|
|
"intl/ngettext.c"
|
|
|
|
"intl/osdep.c"
|
|
|
|
"intl/plural-exp.c"
|
|
|
|
"intl/plural.c"
|
|
|
|
"intl/printf.c"
|
|
|
|
"intl/relocatable.c"
|
|
|
|
"intl/textdomain.c"
|
|
|
|
"intl/version.c"
|
2018-03-02 09:13:57 +08:00
|
|
|
)
|
2018-04-18 07:19:59 +08:00
|
|
|
if(NOT WIN32)
|
|
|
|
list(APPEND SOURCES "intl/setlocale.c")
|
|
|
|
endif()
|
2018-03-02 09:13:57 +08:00
|
|
|
|
|
|
|
set(LOCALDIR "c:/gettext")
|
|
|
|
|
|
|
|
add_definitions(-DLOCALEDIR=\"${LOCALDIR}\")
|
|
|
|
add_definitions(-DLOCALE_ALIAS_PATH=\"${LOCALDIR}\")
|
|
|
|
add_definitions(-DLIBDIR=\"${LOCALDIR}\")
|
|
|
|
add_definitions(-DINSTALLDIR=\"${LOCALDIR}\")
|
2018-03-03 08:54:03 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
add_definitions(-DBUILDING_DLL)
|
|
|
|
endif()
|
|
|
|
add_definitions("-DBUILDING_LIBINTL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY")
|
2018-03-02 09:13:57 +08:00
|
|
|
|
|
|
|
add_definitions("-DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -D_CRT_SECURE_NO_WARNINGS")
|
|
|
|
|
|
|
|
add_library(libintl ${SOURCES})
|
2018-04-18 07:19:59 +08:00
|
|
|
target_link_libraries(libintl PRIVATE unofficial::iconv::libcharset unofficial::iconv::libiconv)
|
2018-03-02 09:13:57 +08:00
|
|
|
|
|
|
|
install(TARGETS libintl
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION bin
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
)
|
|
|
|
|