2014-08-17 07:13:05 -07:00
|
|
|
# Once done these will be defined:
|
|
|
|
#
|
2014-08-20 17:06:39 -07:00
|
|
|
# ICONV_FOUND
|
|
|
|
# ICONV_INCLUDE_DIRS
|
|
|
|
# ICONV_LIBRARIES
|
2014-08-17 07:13:05 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
if (PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(_ICONV QUIET iconv)
|
|
|
|
endif()
|
2014-08-17 07:13:05 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(_lib_suffix 64)
|
|
|
|
else()
|
|
|
|
set(_lib_suffix 32)
|
|
|
|
endif()
|
2014-08-17 07:13:05 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
find_path(ICONV_INCLUDE_DIR
|
|
|
|
NAMES iconv.h
|
|
|
|
HINTS
|
2014-09-23 06:21:27 -07:00
|
|
|
ENV IconvPath${_lib_suffix}
|
2014-09-15 10:58:31 -07:00
|
|
|
ENV IconvPath
|
2014-09-23 06:21:27 -07:00
|
|
|
${_ICONV_INCLUDE_DIRS}
|
2014-09-15 10:58:31 -07:00
|
|
|
PATHS
|
|
|
|
/usr/include /usr/local/include /opt/local/include /sw/include)
|
2014-08-17 07:13:05 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
find_library(ICONV_LIB
|
|
|
|
NAMES ${_ICONV_LIBRARIES} iconv libiconv
|
|
|
|
HINTS
|
|
|
|
${_ICONV_LIBRARY_DIRS}
|
|
|
|
PATHS
|
2014-09-23 06:21:27 -07:00
|
|
|
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
|
|
|
PATH_SUFFIXES
|
|
|
|
lib${_lib_suffix} lib
|
|
|
|
libs${_lib_suffix} libs
|
|
|
|
bin${_lib_suffix} bin)
|
2014-08-17 07:13:05 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Iconv DEFAULT_MSG ICONV_LIB ICONV_INCLUDE_DIR)
|
|
|
|
mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIB)
|
2014-08-17 07:13:05 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
if(ICONV_FOUND)
|
|
|
|
set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
|
|
|
|
set(ICONV_LIBRARIES ${ICONV_LIB})
|
2014-08-17 07:13:05 -07:00
|
|
|
endif()
|