mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
build: pull iconv detection into its own FindIconv.cmake file
This will provide better control for those who may want to alter which one gets used.
This commit is contained in:
@@ -131,6 +131,11 @@ if(LibIntl_FOUND)
|
|||||||
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
|
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(Iconv)
|
||||||
|
if(Iconv_FOUND)
|
||||||
|
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
|
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
|
||||||
# explicitly to indicate a strong preference for pthread.
|
# explicitly to indicate a strong preference for pthread.
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||||
|
18
cmake/FindIconv.cmake
Normal file
18
cmake/FindIconv.cmake
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# - Try to find iconv
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# Iconv_FOUND - system has iconv
|
||||||
|
# Iconv_INCLUDE_DIRS - the iconv include directories
|
||||||
|
# Iconv_LIBRARIES - link these to use iconv
|
||||||
|
|
||||||
|
include(LibFindMacros)
|
||||||
|
|
||||||
|
find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
|
||||||
|
find_library(ICONV_LIBRARY NAMES iconv)
|
||||||
|
|
||||||
|
set(Iconv_PROCESS_INCLUDES ICONV_INCLUDE_DIR)
|
||||||
|
if(ICONV_LIBRARY)
|
||||||
|
set(Iconv_PROCESS_LIBS ICONV_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
libfind_process(Iconv)
|
@@ -44,12 +44,9 @@ check_function_exists(getpwent HAVE_GETPWENT)
|
|||||||
check_function_exists(getpwnam HAVE_GETPWNAM)
|
check_function_exists(getpwnam HAVE_GETPWNAM)
|
||||||
check_function_exists(getpwuid HAVE_GETPWUID)
|
check_function_exists(getpwuid HAVE_GETPWUID)
|
||||||
|
|
||||||
check_include_files(iconv.h HAVE_ICONV_H)
|
if(Iconv_FOUND)
|
||||||
check_library_exists(iconv iconv "" HAVE_ICONV_LIB)
|
set(HAVE_ICONV 1)
|
||||||
if(HAVE_ICONV_LIB)
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES iconv)
|
|
||||||
endif()
|
endif()
|
||||||
check_function_exists(iconv HAVE_ICONV)
|
|
||||||
|
|
||||||
check_function_exists(lstat HAVE_LSTAT)
|
check_function_exists(lstat HAVE_LSTAT)
|
||||||
if(NOT HAVE_LSTAT)
|
if(NOT HAVE_LSTAT)
|
||||||
|
@@ -158,8 +158,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_ICONV_LIB)
|
if(Iconv_LIBRARIES)
|
||||||
list(APPEND NVIM_LINK_LIBRARIES iconv)
|
list(APPEND NVIM_LINK_LIBRARIES ${Iconv_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Put these last on the link line, since multiple things may depend on them.
|
# Put these last on the link line, since multiple things may depend on them.
|
||||||
|
Reference in New Issue
Block a user