Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | # - Try to find SCTP library and headers |
| 2 | # Once done, this will define |
| 3 | # |
| 4 | # SCTP_FOUND - system has SCTP |
| 5 | # SCTP_INCLUDE_DIR - the SCTP include directories |
| 6 | # SCTP_LIBRARIES - link these to use SCTP |
| 7 | |
| 8 | if (SCTP_INCLUDE_DIR AND SCTP_LIBRARIES) |
| 9 | set(SCTP_FIND_QUIETLY TRUE) |
| 10 | endif (SCTP_INCLUDE_DIR AND SCTP_LIBRARIES) |
| 11 | |
| 12 | # Include dir |
| 13 | find_path(SCTP_INCLUDE_DIR |
| 14 | NAMES netinet/sctp.h |
| 15 | ) |
| 16 | |
| 17 | # Library |
| 18 | find_library(SCTP_LIBRARY |
| 19 | NAMES sctp |
| 20 | ) |
| 21 | |
| 22 | # Set the include dir variables and the libraries and let libfind_process do the rest. |
| 23 | # NOTE: Singular variables for this library, plural for libraries this this lib depends on. |
| 24 | #set(SCTP_PROCESS_INCLUDES SCTP_INCLUDE_DIR) |
| 25 | #set(SCTP_PROCESS_LIBS SCTP_LIBRARY) |
| 26 | #libfind_process(SCTP) |
| 27 | |
| 28 | |
| 29 | # handle the QUIETLY and REQUIRED arguments and set SCTP_FOUND to TRUE if |
| 30 | # all listed variables are TRUE |
| 31 | INCLUDE(FindPackageHandleStandardArgs) |
| 32 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SCTP DEFAULT_MSG SCTP_LIBRARY SCTP_INCLUDE_DIR) |
| 33 | |
| 34 | # If we successfully found the sctp library then add the library to the |
| 35 | # SCTP_LIBRARIES cmake variable otherwise set SCTP_LIBRARIES to nothing. |
| 36 | IF(SCTP_FOUND) |
| 37 | SET( SCTP_LIBRARIES ${SCTP_LIBRARY} ) |
| 38 | ELSE(SCTP_FOUND) |
| 39 | SET( SCTP_LIBRARIES ) |
| 40 | ENDIF(SCTP_FOUND) |
| 41 | |
| 42 | |
| 43 | # Lastly make it so that the SCTP_LIBRARY and SCTP_INCLUDE_DIR variables |
| 44 | # only show up under the advanced options in the gui cmake applications. |
| 45 | MARK_AS_ADVANCED( SCTP_LIBRARY SCTP_INCLUDE_DIR ) |
| 46 | |