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.5.0)
10 set(LYX_IPO_SUPPORTED FALSE)
12 cmake_policy(SET CMP0069 NEW)
13 if (LYX_USE_IPO MATCHES "ON")
14 set(LYX_IPO_SUPPORTED YES)
18 cmake_policy(SET CMP0075 NEW)
21 set(CMAKE_MODULE_PATH .)
22 include ( configure.cmake )
24 set(LIBICONV_VERSION 1.15)
26 set(SRCDIR ${LIBICONV_VERSION})
29 option(ENABLE_EXTRA "Enable a few rarely used encodings" OFF)
30 option(ENABLE_NLS "Translation of program messages to the user's native
31 language is requested" OFF)
32 #option(ENABLE_RELOCATABLE "The package shall run at any location in the file system" ON)
39 set(BINDIR ${CMAKE_BINARY_DIR}/libiconv)
40 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
41 configure_file(${SRCDIR}/include/iconv.h.build.in ${CMAKE_CURRENT_BINARY_DIR}/iconv.h)
43 configure_file(${SRCDIR}/libcharset/include/libcharset.h.in ${BINDIR}/include/libcharset.h)
44 configure_file(${SRCDIR}/srclib/uniwidth.in.h ${BINDIR}/srclib/uniwidth.h)
45 configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h)
46 configure_file(${SRCDIR}/include/iconv.h.in ${BINDIR}/include/iconv.h)
50 add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
53 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib)
54 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)
57 set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
60 set(SRC_LIBICONV ${SRCDIR}/lib/iconv.c ${SRCDIR}/lib/relocatable.c)
62 add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
63 set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
65 set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include dir" FORCE)
66 set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
67 set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE)
69 set_target_properties(iconv PROPERTIES
71 INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED})