summaryrefslogtreecommitdiff
path: root/CMake/FindIconv.cmake
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-26 17:55:28 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-26 22:24:25 +0200
commit01d207a5076b6fc37a064645b13f2c6550f58b94 (patch)
treeed04cb857a9f5d4c53a84d9951834fa5bb2a1cac /CMake/FindIconv.cmake
parent6f1f3c9afdb6ade6a7be110b90c8fc9e603254cf (diff)
CMake: Add missing iconv dependency
FreeBSD has two iconv systems: It ships an iconv.h itself, and symbols for that in the libc. But there's also the port of GNU libiconv, which unfortunately for us, Doxygen depends on. This changes things to prefer a separate libiconv library over the system one; that is, the port on FreeBSD. Gbp-Dch: ignore
Diffstat (limited to 'CMake/FindIconv.cmake')
-rw-r--r--CMake/FindIconv.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMake/FindIconv.cmake b/CMake/FindIconv.cmake
new file mode 100644
index 000000000..67046d95d
--- /dev/null
+++ b/CMake/FindIconv.cmake
@@ -0,0 +1,20 @@
+find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
+
+find_library(ICONV_LIBRARY NAMES iconv)
+if (ICONV_LIBRARY)
+ set(ICONV_SYMBOL_FOUND "${ICONV_LIBRARY}")
+else()
+ check_function_exists(iconv_open ICONV_SYMBOL_FOUND)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Iconv DEFAULT_MESSAGE ICONV_INCLUDE_DIR ICONV_SYMBOL_FOUND)
+
+if(ICONV_LIBRARY)
+ set(ICONV_LIBRARIES "${ICONV_LIBRARY}")
+else()
+ set(ICONV_LIBRARIES)
+endif()
+set(ICONV_INCLUDE_DIRS "${ICONV_INCLUDE_DIR}")
+
+mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR)