Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | # - 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 | |
| 8 | if (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES) |
| 9 | set(IDNA_FIND_QUIETLY TRUE) |
| 10 | endif (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES) |
| 11 | |
| 12 | # Include dir |
| 13 | find_path(IDNA_INCLUDE_DIR |
| 14 | NAMES idna.h |
| 15 | ) |
| 16 | |
| 17 | # Library |
| 18 | find_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 |
| 25 | INCLUDE(FindPackageHandleStandardArgs) |
| 26 | FIND_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. |
| 30 | IF(IDNA_FOUND) |
| 31 | SET( IDNA_LIBRARIES ${IDNA_LIBRARY} ) |
| 32 | ELSE(IDNA_FOUND) |
| 33 | SET( IDNA_LIBRARIES ) |
| 34 | ENDIF(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. |
| 39 | MARK_AS_ADVANCED( IDNA_LIBRARY IDNA_INCLUDE_DIR ) |
| 40 | |