FindIconv¶
Added in version 3.11.
Finds the iconv() POSIX.1 functions on the system:
find_package(Iconv [<version>] [...])
Iconv functions might be provided in the standard C library or externally in the form of an additional library.
Imported Targets¶
This module provides the following Imported Targets:
Iconv::IconvTarget encapsulating the iconv usage requirements, available only if iconv is found.
Result Variables¶
This module defines the following variables:
Iconv_FOUNDBoolean indicating whether the (requested version of) iconv support was found.
Iconv_VERSIONAdded in version 3.21.
The version of iconv found (x.y).
Note
Some libiconv implementations don't embed the version in their header files. In this case the variables
Iconv_VERSION*will be empty.Iconv_VERSION_MAJORAdded in version 3.21.
The major version of iconv.
Iconv_VERSION_MINORAdded in version 3.21.
The minor version of iconv.
Iconv_INCLUDE_DIRSThe include directories containing the iconv headers.
Iconv_LIBRARIESThe iconv libraries to be linked.
Cache Variables¶
The following cache variables may also be set:
Iconv_IS_BUILT_INA boolean variable indicating whether iconv support is stemming from the C standard library or not. Even if the C library provides
iconv(), the presence of an externallibiconvimplementation might lead to this being false.Iconv_INCLUDE_DIRThe directory containing the iconv headers.
Iconv_LIBRARYThe iconv library (if not implicitly given in the C library).
Note
On POSIX platforms, iconv might be part of the C library and the cache
variables Iconv_INCLUDE_DIR and Iconv_LIBRARY might be empty.
Examples¶
Finding iconv and linking it to a project target:
find_package(Iconv)
target_link_libraries(project_target PRIVATE Iconv::Iconv)