]> git.lyx.org Git - lyx.git/blob - 3rdparty/libiconv/CMakeLists.txt
Cmake build: Remove warnings about deprecated policy CMP0069
[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   if (NOT LYX_DEBUG)
13     cmake_policy(SET CMP0069 NEW)
14     include(CheckIPOSupported)
15     check_ipo_supported(RESULT LYX_IPO_SUPPORTED)
16   endif()
17 endif()
18
19 set(CMAKE_MODULE_PATH .)
20 include ( configure.cmake )
21
22 set(LIBICONV_VERSION 1.15)
23
24 set(SRCDIR ${LIBICONV_VERSION})
25
26 # Options
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)
31
32 # iconv.h
33 set(USE_MBSTATE_T 1)
34 set(BROKEN_WCHAR_H 0)
35 set(HAVE_WCHAR_T 0)
36
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)
40
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)
45
46 # Dirty fix for MinGW
47 if(MINGW)
48   add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
49 endif ()
50
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)
53
54 # libcharset
55 set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
56
57 # libiconv
58 set(SRC_LIBICONV ${SRCDIR}/lib/iconv.c ${SRCDIR}/lib/relocatable.c)
59
60 add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
61 set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
62
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)
66
67 set_target_properties(iconv PROPERTIES
68         FOLDER "3rd_party"
69         INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED})