Skip to content

Commit

Permalink
Link to iconv library.
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Feb 11, 2016
1 parent be71520 commit 20cec49
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ endif(ENABLE_LOGGING)

find_package(Threads)

find_package(Iconv)
if (ICONV_FOUND)
include_directories(${ICONV_INCLUDE_DIRS})
endif(ICONV_FOUND)

if(BUILD_TEST)
find_package(GTest REQUIRED)
if(GTEST_FOUND)
Expand Down
43 changes: 43 additions & 0 deletions cmake/FindIconv.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Find iconv library
#
# Author: Eddy Xu <eddyxu at gmail.com>
#
# Released under BSD license
#
# ICONV_INCLUDE_DIRS - where to find iconv.h, etc
# ICONV_LIBRARIES - Lists of libraries when using iconv
# ICONV_FOUND - True if iconv found


# Look for the header file
FIND_PATH( ICONV_INCLUDE_DIR NAMES iconv.h )
MARK_AS_ADVANCED( ICONV_INCLUDE_DIR )

# Look for the library
FIND_LIBRARY( ICONV_LIBRARY NAMES iconv )
MARK_AS_ADVANCED( ICONV_LIBRARY )

# Copy the result to output variables
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
SET(ICONV_FOUND 1)
SET(ICONV_LIBRARIES ${ICONV_LIBRARY})
SET(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
ELSE(ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
SET(ICONV_FOUND 0)
SET(ICONV_LIBRARIES)
SET(ICONV_INCLUDE_DIRS)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARY)

# Report results
IF(NOT ICONV_FOUND)
SET(ICONV_DIR_MESSAGE
"Iconv was not found. Make sure ICONV_LIBRARY and ICONV_INCLUDE_DIR are
set.")
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS ${ICONV_DIR_MESSAGE})
ELSE(NOT ICONV_FIND_QUIETLY)
IF(ICONV_FIND_REQUIRED)
MESSAGE(FETAL_ERROR ${ICONV_DIR_MESSAGE})
ENDIF(ICONV_FIND_REQUIRED)
ENDIF(NOT ICONV_FIND_QUIETLY)
ENDIF(NOT ICONV_FOUND)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(Gflags_FOUND)
endif(Gflags_FOUND)

set(RIME_CORE_DEPS ${Boost_LIBRARIES} ${Glog_LIBRARY} ${YamlCpp_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${RIME_OPTIONAL_DEPS})
set(RIME_EXTRA_DEPS ${LevelDb_LIBRARY} ${Marisa_LIBRARY} ${Opencc_LIBRARY})
set(RIME_EXTRA_DEPS ${ICONV_LIBRARIES} ${LevelDb_LIBRARY} ${Marisa_LIBRARY} ${Opencc_LIBRARY})

if(BUILD_SEPARATE_LIBS)
set(RIME_DEPS ${RIME_CORE_DEPS})
Expand Down

0 comments on commit 20cec49

Please sign in to comment.