]> git.saurik.com Git - apt.git/commitdiff
CMake: Add missing iconv dependency
authorJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 15:55:28 +0000 (17:55 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 20:24:25 +0000 (22:24 +0200)
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

CMake/FindIconv.cmake [new file with mode: 0644]
CMakeLists.txt
apt-pkg/CMakeLists.txt

diff --git a/CMake/FindIconv.cmake b/CMake/FindIconv.cmake
new file mode 100644 (file)
index 0000000..67046d9
--- /dev/null
@@ -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)
index 24c58a0f8ad55ac6603b99430e798d385695bad2..35c75b18a2c8543cb634d7c6359960cc1285fe66 100644 (file)
@@ -29,6 +29,7 @@ include(GNUInstallDirs)
 include(TestBigEndian)
 find_package(Threads)
 find_package(LFS REQUIRED)
+find_package(Iconv REQUIRED)
 
 if(USE_NLS)
   find_package(Intl REQUIRED)
index 3f85bc1434ac3dcb2ee0f610a8b97a609685a741..34930c8e95311aab9aafa4a9dee0036ebccc8490 100644 (file)
@@ -28,14 +28,19 @@ target_include_directories(apt-pkg
                            PRIVATE ${ZLIB_INCLUDE_DIRS}
                                    ${BZIP2_INCLUDE_DIR}
                                    ${LZMA_INCLUDE_DIRS}
-                                   ${LZ4_INCLUDE_DIRS})
+                                   ${LZ4_INCLUDE_DIRS}
+                                   ${ICONV_DIRECTORIES}
+)
+
 target_link_libraries(apt-pkg
                       PRIVATE -lutil ${CMAKE_DL_LIBS} ${RESOLV_LIBRARIES}
                              ${CMAKE_THREAD_LIBS_INIT}
                              ${ZLIB_LIBRARIES}
                              ${BZIP2_LIBRARIES}
                              ${LZMA_LIBRARIES}
-                             ${LZ4_LIBRARIES})
+                             ${LZ4_LIBRARIES}
+                             ${ICONV_LIBRARIES}
+)
 set_target_properties(apt-pkg PROPERTIES VERSION ${MAJOR}.${MINOR})
 set_target_properties(apt-pkg PROPERTIES SOVERSION ${MAJOR})
 add_version_script(apt-pkg)