-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#.rst: | ||
# FindICONV | ||
# -------- | ||
# Finds the ICONV library | ||
# | ||
# This will define the following variables:: | ||
# | ||
# ICONV_FOUND - system has ICONV | ||
# ICONV_INCLUDE_DIRS - the ICONV include directory | ||
# ICONV_LIBRARIES - the ICONV libraries | ||
# | ||
# and the following imported targets:: | ||
# | ||
# ICONV::ICONV - The ICONV library | ||
|
||
find_path(ICONV_INCLUDE_DIR NAMES iconv.h) | ||
|
||
find_library(ICONV_LIBRARY NAMES iconv libiconv c) | ||
|
||
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY}) | ||
include(CheckFunctionExists) | ||
check_function_exists(iconv HAVE_ICONV_FUNCTION) | ||
if(NOT HAVE_ICONV_FUNCTION) | ||
check_function_exists(libiconv HAVE_LIBICONV_FUNCTION2) | ||
set(HAVE_ICONV_FUNCTION ${HAVE_LIBICONV_FUNCTION2}) | ||
unset(HAVE_LIBICONV_FUNCTION2) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Iconv | ||
REQUIRED_VARS ICONV_LIBRARY ICONV_INCLUDE_DIR HAVE_ICONV_FUNCTION) | ||
|
||
if(ICONV_FOUND) | ||
set(ICONV_LIBRARIES ${ICONV_LIBRARY}) | ||
set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR}) | ||
|
||
if(NOT TARGET ICONV::ICONV) | ||
add_library(ICONV::ICONV UNKNOWN IMPORTED) | ||
set_target_properties(ICONV::ICONV PROPERTIES | ||
IMPORTED_LOCATION "${ICONV_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${ICONV_INCLUDE_DIR}") | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY HAVE_ICONV_FUNCTION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters