Blame cmake/Modules/FindIconv.cmake

Packit Service 20376f
# - Try to find Iconv
Packit Service 20376f
# Once done this will define
Packit Service 20376f
#
Packit Service 20376f
# ICONV_FOUND - system has Iconv
Packit Service 20376f
# ICONV_INCLUDE_DIR - the Iconv include directory
Packit Service 20376f
# ICONV_LIBRARIES - Link these to use Iconv
Packit Service 20376f
#
Packit Service 20376f
Packit Service 20376f
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
Packit Service 20376f
	# Already in cache, be silent
Packit Service 20376f
	SET(ICONV_FIND_QUIETLY TRUE)
Packit Service 20376f
ENDIF()
Packit Service 20376f
Packit Service 20376f
FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
Packit Service 20376f
FIND_LIBRARY(iconv_lib NAMES iconv libiconv libiconv-2 c)
Packit Service 20376f
Packit Service 20376f
IF(ICONV_INCLUDE_DIR AND iconv_lib)
Packit Service 20376f
	 SET(ICONV_FOUND TRUE)
Packit Service 20376f
ENDIF()
Packit Service 20376f
Packit Service 20376f
IF(ICONV_FOUND)
Packit Service 20376f
	# split iconv into -L and -l linker options, so we can set them for pkg-config
Packit Service 20376f
	GET_FILENAME_COMPONENT(iconv_path ${iconv_lib} PATH)
Packit Service 20376f
	GET_FILENAME_COMPONENT(iconv_name ${iconv_lib} NAME_WE)
Packit Service 20376f
	STRING(REGEX REPLACE "^lib" "" iconv_name ${iconv_name})
Packit Service 20376f
	SET(ICONV_LIBRARIES "-L${iconv_path} -l${iconv_name}")
Packit Service 20376f
Packit Service 20376f
	IF(NOT ICONV_FIND_QUIETLY)
Packit Service 20376f
		MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
Packit Service 20376f
	ENDIF(NOT ICONV_FIND_QUIETLY)
Packit Service 20376f
ELSE()
Packit Service 20376f
	IF(Iconv_FIND_REQUIRED)
Packit Service 20376f
		MESSAGE(FATAL_ERROR "Could not find Iconv")
Packit Service 20376f
	ENDIF(Iconv_FIND_REQUIRED)
Packit Service 20376f
ENDIF()
Packit Service 20376f
Packit Service 20376f
MARK_AS_ADVANCED(
Packit Service 20376f
	ICONV_INCLUDE_DIR
Packit Service 20376f
	ICONV_LIBRARIES
Packit Service 20376f
)