summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindIconv.cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2018-01-01 13:40:09 +0100
committermanuel <manuel@mausz.at>2018-01-01 13:40:09 +0100
commit4830f27a40323fe859dc166337a2b861877b7121 (patch)
tree39e9f712a5415ec0026c3914f4bf600b2f679287 /cmake/modules/FindIconv.cmake
parent0afb1d4d51973cf52973617c92236d851a039d31 (diff)
downloadkodi-pvr-build-4830f27a40323fe859dc166337a2b861877b7121.tar.gz
kodi-pvr-build-4830f27a40323fe859dc166337a2b861877b7121.tar.bz2
kodi-pvr-build-4830f27a40323fe859dc166337a2b861877b7121.zip
sync with upstream
Diffstat (limited to 'cmake/modules/FindIconv.cmake')
-rw-r--r--cmake/modules/FindIconv.cmake44
1 files changed, 44 insertions, 0 deletions
diff --git a/cmake/modules/FindIconv.cmake b/cmake/modules/FindIconv.cmake
new file mode 100644
index 0000000..8ee01fb
--- /dev/null
+++ b/cmake/modules/FindIconv.cmake
@@ -0,0 +1,44 @@
1#.rst:
2# FindICONV
3# --------
4# Finds the ICONV library
5#
6# This will will define the following variables::
7#
8# ICONV_FOUND - system has ICONV
9# ICONV_INCLUDE_DIRS - the ICONV include directory
10# ICONV_LIBRARIES - the ICONV libraries
11#
12# and the following imported targets::
13#
14# ICONV::ICONV - The ICONV library
15
16find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
17
18find_library(ICONV_LIBRARY NAMES iconv libiconv c)
19
20set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
21check_function_exists(iconv HAVE_ICONV_FUNCTION)
22if(NOT HAVE_ICONV_FUNCTION)
23 check_function_exists(libiconv HAVE_LIBICONV_FUNCTION2)
24 set(HAVE_ICONV_FUNCTION ${HAVE_LIBICONV_FUNCTION2})
25 unset(HAVE_LIBICONV_FUNCTION2)
26endif()
27
28include(FindPackageHandleStandardArgs)
29find_package_handle_standard_args(Iconv
30 REQUIRED_VARS ICONV_LIBRARY ICONV_INCLUDE_DIR HAVE_ICONV_FUNCTION)
31
32if(ICONV_FOUND)
33 set(ICONV_LIBRARIES ${ICONV_LIBRARY})
34 set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
35
36 if(NOT TARGET ICONV::ICONV)
37 add_library(ICONV::ICONV UNKNOWN IMPORTED)
38 set_target_properties(ICONV::ICONV PROPERTIES
39 IMPORTED_LOCATION "${ICONV_LIBRARY}"
40 INTERFACE_INCLUDE_DIRECTORIES "${ICONV_INCLUDE_DIR}")
41 endif()
42endif()
43
44mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY HAVE_ICONV_FUNCTION)