2015-12-09 09:11:10 +00:00
|
|
|
# Copyright (C) 2007-2012 LuaDist.
|
|
|
|
# Created by Peter Drahoš
|
|
|
|
# Redistribution and use of this file is allowed according to the terms of the MIT license.
|
|
|
|
# For details see the COPYRIGHT file distributed with LuaDist.
|
|
|
|
# Please note that the package source code is licensed under its own license.
|
|
|
|
|
|
|
|
project ( libiconv C )
|
2023-12-31 14:18:11 +00:00
|
|
|
cmake_minimum_required(VERSION 3.5.0)
|
2019-04-22 16:49:03 +00:00
|
|
|
|
2019-11-09 15:56:16 +00:00
|
|
|
set(LYX_IPO_SUPPORTED FALSE)
|
2019-04-22 16:49:03 +00:00
|
|
|
if (POLICY CMP0069)
|
2019-12-17 12:59:52 +00:00
|
|
|
cmake_policy(SET CMP0069 NEW)
|
|
|
|
if (LYX_USE_IPO MATCHES "ON")
|
|
|
|
set(LYX_IPO_SUPPORTED YES)
|
2019-11-09 15:56:16 +00:00
|
|
|
endif()
|
2019-04-22 16:49:03 +00:00
|
|
|
endif()
|
2022-11-10 15:34:15 +00:00
|
|
|
if (POLICY CMP0075)
|
|
|
|
cmake_policy(SET CMP0075 NEW)
|
|
|
|
endif()
|
2019-04-22 16:49:03 +00:00
|
|
|
|
2015-12-09 09:11:10 +00:00
|
|
|
set(CMAKE_MODULE_PATH .)
|
|
|
|
include ( configure.cmake )
|
|
|
|
|
2017-09-10 12:46:37 +00:00
|
|
|
set(LIBICONV_VERSION 1.15)
|
2015-12-09 09:11:10 +00:00
|
|
|
|
|
|
|
set(SRCDIR ${LIBICONV_VERSION})
|
|
|
|
|
|
|
|
# Options
|
|
|
|
option(ENABLE_EXTRA "Enable a few rarely used encodings" OFF)
|
|
|
|
option(ENABLE_NLS "Translation of program messages to the user's native
|
|
|
|
language is requested" OFF)
|
|
|
|
#option(ENABLE_RELOCATABLE "The package shall run at any location in the file system" ON)
|
|
|
|
|
|
|
|
# iconv.h
|
|
|
|
set(USE_MBSTATE_T 1)
|
|
|
|
set(BROKEN_WCHAR_H 0)
|
|
|
|
set(HAVE_WCHAR_T 0)
|
|
|
|
|
|
|
|
set(BINDIR ${CMAKE_BINARY_DIR}/libiconv)
|
2015-12-09 16:59:47 +00:00
|
|
|
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
configure_file(${SRCDIR}/include/iconv.h.build.in ${CMAKE_CURRENT_BINARY_DIR}/iconv.h)
|
|
|
|
|
2015-12-09 09:11:10 +00:00
|
|
|
configure_file(${SRCDIR}/libcharset/include/libcharset.h.in ${BINDIR}/include/libcharset.h)
|
|
|
|
configure_file(${SRCDIR}/srclib/uniwidth.in.h ${BINDIR}/srclib/uniwidth.h)
|
|
|
|
configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h)
|
2015-12-09 16:59:47 +00:00
|
|
|
configure_file(${SRCDIR}/include/iconv.h.in ${BINDIR}/include/iconv.h)
|
2015-12-09 09:11:10 +00:00
|
|
|
|
|
|
|
# Dirty fix for MinGW
|
|
|
|
if(MINGW)
|
|
|
|
add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
|
|
|
|
endif ()
|
|
|
|
|
2015-12-09 20:38:45 +00:00
|
|
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib)
|
2015-12-09 09:11:10 +00:00
|
|
|
add_definitions(-Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -DINSTALLPREFIX=NULL -DNO_XMALLOC -DBUILDING_LIBCHARSET -DINSTALLDIR="" -DLIBDIR="" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY)
|
|
|
|
|
|
|
|
# libcharset
|
|
|
|
set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
|
|
|
|
|
|
|
|
# libiconv
|
2016-07-03 16:51:22 +00:00
|
|
|
set(SRC_LIBICONV ${SRCDIR}/lib/iconv.c ${SRCDIR}/lib/relocatable.c)
|
2015-12-09 09:11:10 +00:00
|
|
|
|
|
|
|
add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
|
|
|
|
set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
|
|
|
|
|
|
|
|
set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include dir" FORCE)
|
|
|
|
set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
|
|
|
|
set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE)
|
2015-12-09 16:59:47 +00:00
|
|
|
|
2019-11-09 15:56:16 +00:00
|
|
|
set_target_properties(iconv PROPERTIES
|
|
|
|
FOLDER "3rd_party"
|
|
|
|
INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED})
|