]> git.lyx.org Git - lyx.git/blob - 3rdparty/libiconv/CMakeLists.txt
Fix warning
[lyx.git] / 3rdparty / libiconv / CMakeLists.txt
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.
6
7 project ( libiconv C )
8 cmake_minimum_required(VERSION 3.1)
9
10 set(LYX_IPO_SUPPORTED FALSE)
11 if (POLICY CMP0069)
12   cmake_policy(SET CMP0069 NEW)
13   if (LYX_USE_IPO MATCHES "ON")
14     set(LYX_IPO_SUPPORTED YES)
15   endif()
16 endif()
17
18 set(CMAKE_MODULE_PATH .)
19 include ( configure.cmake )
20
21 set(LIBICONV_VERSION 1.15)
22
23 set(SRCDIR ${LIBICONV_VERSION})
24
25 # Options
26 option(ENABLE_EXTRA "Enable a few rarely used encodings" OFF)
27 option(ENABLE_NLS "Translation of program messages to the user's native
28    language is requested" OFF)
29 #option(ENABLE_RELOCATABLE "The package shall run at any location in the file system" ON)
30
31 # iconv.h
32 set(USE_MBSTATE_T 1)
33 set(BROKEN_WCHAR_H 0)
34 set(HAVE_WCHAR_T 0)
35
36 set(BINDIR ${CMAKE_BINARY_DIR}/libiconv)
37 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
38 configure_file(${SRCDIR}/include/iconv.h.build.in ${CMAKE_CURRENT_BINARY_DIR}/iconv.h)
39
40 configure_file(${SRCDIR}/libcharset/include/libcharset.h.in ${BINDIR}/include/libcharset.h)
41 configure_file(${SRCDIR}/srclib/uniwidth.in.h ${BINDIR}/srclib/uniwidth.h)
42 configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h)
43 configure_file(${SRCDIR}/include/iconv.h.in ${BINDIR}/include/iconv.h)
44
45 # Dirty fix for MinGW
46 if(MINGW)
47   add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
48 endif ()
49
50 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib)
51 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)
52
53 # libcharset
54 set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
55
56 # libiconv
57 set(SRC_LIBICONV ${SRCDIR}/lib/iconv.c ${SRCDIR}/lib/relocatable.c)
58
59 add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
60 set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
61
62 set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include  dir" FORCE)
63 set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
64 set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE)
65
66 set_target_properties(iconv PROPERTIES
67         FOLDER "3rd_party"
68         INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED})