blob: e5463b4d7a5839ede2d9db288f997c5e94122722 [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001# - Try to find GNU IDN library and headers
2# Once done, this will define
3#
4# IDNA_FOUND - system has IDNA
5# IDNA_INCLUDE_DIR - the IDNA include directories (<idna.h>)
6# IDNA_LIBRARIES - link these to use IDNA (idna_to_ascii_8z)
7
8if (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES)
9 set(IDNA_FIND_QUIETLY TRUE)
10endif (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES)
11
12# Include dir
13find_path(IDNA_INCLUDE_DIR
14 NAMES idna.h
15)
16
17# Library
18find_library(IDNA_LIBRARY
19 NAMES idn
20)
21
22
23# handle the QUIETLY and REQUIRED arguments and set IDNA_FOUND to TRUE if
24# all listed variables are TRUE
25INCLUDE(FindPackageHandleStandardArgs)
26FIND_PACKAGE_HANDLE_STANDARD_ARGS(IDNA DEFAULT_MSG IDNA_LIBRARY IDNA_INCLUDE_DIR)
27
28# If we successfully found the idn library then add the library to the
29# IDNA_LIBRARIES cmake variable otherwise set IDNA_LIBRARIES to nothing.
30IF(IDNA_FOUND)
31 SET( IDNA_LIBRARIES ${IDNA_LIBRARY} )
32ELSE(IDNA_FOUND)
33 SET( IDNA_LIBRARIES )
34ENDIF(IDNA_FOUND)
35
36
37# Lastly make it so that the IDNA_LIBRARY and IDNA_INCLUDE_DIR variables
38# only show up under the advanced options in the gui cmake applications.
39MARK_AS_ADVANCED( IDNA_LIBRARY IDNA_INCLUDE_DIR )
40