mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix: uses libc iconv on FreeBSD
This commit is contained in:
parent
2acf36d421
commit
4304fc9aef
|
@ -33,7 +33,6 @@ find_package(PkgConfig REQUIRED)
|
|||
# Provided by Cmake
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(Iconv REQUIRED)
|
||||
|
||||
|
||||
# Consider all PkgConfig dependencies as one
|
||||
|
@ -50,8 +49,19 @@ target_link_libraries(${GOLDENDICT} PRIVATE
|
|||
PkgConfig::PKGCONFIG_DEPS
|
||||
BZip2::BZip2
|
||||
ZLIB::ZLIB
|
||||
Iconv::Iconv
|
||||
)
|
||||
)
|
||||
|
||||
# On FreeBSD, there are two iconv, libc iconv & GNU libiconv.
|
||||
# The system one is good enough, the following is a workaround to use libc iconv on freeBSD.
|
||||
if (BSD STREQUAL "FreeBSD")
|
||||
# Simply do nothing. libc includes iconv on freeBSD.
|
||||
# LIBICONV_PLUG is a magic word to turn /usr/include/local/inconv.h, which belong to GNU libiconv, into normal iconv.h
|
||||
# Same hack used by SDL https://github.com/libsdl-org/SDL/blob/d6ebbc2fa4abdbe0bd53d0ce8804a492ecb042b9/src/stdlib/SDL_iconv.c#L27-L28
|
||||
target_compile_definitions(${GOLDENDICT} PUBLIC LIBICONV_PLUG)
|
||||
else ()
|
||||
find_package(Iconv REQUIRED)
|
||||
target_link_libraries(${GOLDENDICT} PRIVATE Iconv::Iconv)
|
||||
endif ()
|
||||
|
||||
if (WITH_FFMPEG_PLAYER)
|
||||
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
|
||||
|
|
Loading…
Reference in a new issue