]> git.lyx.org Git - features.git/blob - src/3rdparty/libiconv/CMakeLists.txt
build libiconv with cmake
[features.git] / src / 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 2.8 )
9 set(CMAKE_MODULE_PATH .)
10 include ( configure.cmake )
11
12 set(LIBICONV_VERSION 1.14)
13
14 set(SRCDIR ${LIBICONV_VERSION})
15
16 # Options
17 option(ENABLE_EXTRA "Enable a few rarely used encodings" OFF)
18 option(ENABLE_NLS "Translation of program messages to the user's native
19    language is requested" OFF)
20 #option(ENABLE_RELOCATABLE "The package shall run at any location in the file system" ON)
21
22 # iconv.h
23 set(USE_MBSTATE_T 1)
24 set(BROKEN_WCHAR_H 0)
25 set(HAVE_WCHAR_T 0)
26
27 set(BINDIR ${CMAKE_BINARY_DIR}/libiconv)
28 configure_file(config.h.cmake ${BINDIR}/config.h)
29 configure_file(${SRCDIR}/include/iconv.h.build.in ${BINDIR}/include/iconv.h)
30 configure_file(${SRCDIR}/libcharset/include/libcharset.h.in ${BINDIR}/include/libcharset.h)
31 configure_file(${SRCDIR}/srclib/uniwidth.in.h ${BINDIR}/srclib/uniwidth.h)
32 configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h)
33
34 # Dirty fix for MinGW
35 if(MINGW)
36   add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0)
37 endif ()
38
39 include_directories( ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib)
40 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)
41
42 # libcharset
43 set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c)
44
45 # libiconv
46 set(SRC_LIBICONV ${SRCDIR}/lib/iconv.c)
47
48 add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET})
49 set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV)
50
51 set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include  dir" FORCE)
52 set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE)
53 set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE)