1 # Copyright (C) 2007-2012 LuaDist.
2 # Created by Peter Drahoš
3 # Redistribution and use of this file is allowed according to the terms of the MIT license.
4 # For details see the COPYRIGHT file distributed with LuaDist.
5 # Please note that the package source code is licensed under its own license.
8 cmake_minimum_required(VERSION 3.1)
10 set(LYX_IPO_SUPPORTED FALSE)
13 cmake_policy(SET CMP0069 NEW)
14 include(CheckIPOSupported)
15 check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
19 set(CMAKE_MODULE_PATH .)
20 include ( configure.cmake )
22 set(LIBICONV_VERSION 1.15)
24 set(SRCDIR ${LIBICONV_VERSION})
27 option(ENABLE_EXTRA "Enable a few rarely used encodings" OFF)
28 option(ENABLE_NLS "Translation of program messages to the user's native
29 language is requested" OFF)
30 #option(ENABLE_RELOCATABLE "The package shall run at any location in the file system" ON)
37 set(BINDIR ${CMAKE_BINARY_DIR}/libiconv)
38 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
39 configure_file(${SRCDIR}/include/iconv.h.build.in ${CMAKE_CURRENT_BINARY_DIR}/iconv.h)
41 configure_file(${SRCDIR}/libcharset/include/libcharset.h.in ${BINDIR}/include/libcharset.h)
42 configure_file(${SRCDIR}/srclib/uniwidth.in.h ${BINDIR}/srclib/uniwidth.h)
43 configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h)
44 configure_file(${SRCDIR}/include/iconv.h.in ${BINDIR}/include/iconv.h)
48 add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
51 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib)
52 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)
55 set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
58 set(SRC_LIBICONV ${SRCDIR}/lib/iconv.c ${SRCDIR}/lib/relocatable.c)
60 add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
61 set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
63 set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include dir" FORCE)
64 set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
65 set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE)
67 set_target_properties(iconv PROPERTIES
69 INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED})