Mercurial > hg > freeDiameter
comparison include/freeDiameter/CMakeLists.txt @ 1561:699c3fb0c57b
Switch from libidn to libidn2.
libidn2 is the backwards compatible successor to libidn,
and at least Red Hat 8 does not provide a dev package for libidn1.
author | Thomas Klausner <wiz@gatalith.at> |
---|---|
date | Wed, 16 Jun 2021 18:44:45 +0200 |
parents | deaa89f4a994 |
children |
comparison
equal
deleted
inserted
replaced
1560:9084c6f94a0a | 1561:699c3fb0c57b |
---|---|
1 #CMake configuration for freeDiameter include directory | 1 #CMake configuration for freeDiameter include directory |
2 | 2 |
3 Project("freeDiameter includes directory" C) | 3 Project("freeDiameter includes directory" C) |
4 | |
5 INCLUDE(FindPkgConfig) | |
4 | 6 |
5 ######################## | 7 ######################## |
6 # Configurable parameters | 8 # Configurable parameters |
7 | 9 |
8 # Disable SCTP support completely ? | 10 # Disable SCTP support completely ? |
133 MESSAGE(STATUS "Disabled SCTP support.") | 135 MESSAGE(STATUS "Disabled SCTP support.") |
134 ENDIF(NOT DISABLE_SCTP) | 136 ENDIF(NOT DISABLE_SCTP) |
135 SET(SCTP_INCLUDE_DIR ${SCTP_INCLUDE_DIR} PARENT_SCOPE) | 137 SET(SCTP_INCLUDE_DIR ${SCTP_INCLUDE_DIR} PARENT_SCOPE) |
136 SET(SCTP_LIBRARIES ${SCTP_LIBRARIES} PARENT_SCOPE) | 138 SET(SCTP_LIBRARIES ${SCTP_LIBRARIES} PARENT_SCOPE) |
137 | 139 |
138 # IDNA process: we use libidn from GNU (unless the function & header files are included in libc) | 140 # IDNA process: we use GNU libidn2 |
139 IF(NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) | 141 IF(NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) |
140 FIND_PACKAGE(IDNA) | 142 PKG_CHECK_MODULES(IDNA libidn2) |
141 SET(CHECK_IDNA_SOURCE_CODE " | 143 IF(NOT IDNA_FOUND) |
142 #include <idna.h> | 144 MESSAGE(SEND_ERROR "Unable to find libidn2, please install libidn2-dev or equivalent, or set DIAMID_IDNA_IGNORE or DIAMID_IDNA_REJECT") |
143 int main() { | 145 ENDIF() |
144 return idna_to_ascii_8z(NULL, NULL, 0); | |
145 } | |
146 ") | |
147 SET(CMAKE_REQUIRED_INCLUDES ${IDNA_INCLUDE_DIR}) | |
148 SET(CMAKE_REQUIRED_LIBRARIES ${IDNA_LIBRARIES}) | |
149 CHECK_C_SOURCE_COMPILES("${CHECK_IDNA_SOURCE_CODE}" HAS_IDNA_SUPPORT) | |
150 IF(NOT HAS_IDNA_SUPPORT) | |
151 MESSAGE(SEND_ERROR "Unable to find idna.h header or idna_to_ascii_8z function, please install libidn-dev or equivalent, or set DIAMID_IDNA_IGNORE or DIAMID_IDNA_REJECT") | |
152 ENDIF(NOT HAS_IDNA_SUPPORT) | |
153 ELSE (NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) | 146 ELSE (NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) |
154 MESSAGE(STATUS "Non-default Internationalized Domain Names (IDN) behavior selected (no stringprep).") | 147 MESSAGE(STATUS "Non-default Internationalized Domain Names (IDN) behavior selected (no stringprep).") |
155 ENDIF(NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) | 148 ENDIF(NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) |
156 SET(IDNA_INCLUDE_DIR ${IDNA_INCLUDE_DIR} PARENT_SCOPE) | |
157 SET(IDNA_LIBRARIES ${IDNA_LIBRARIES} PARENT_SCOPE) | |
158 | 149 |
159 | 150 |
160 # Require GNU TLS for building the library | 151 # Require GNU TLS for building the library |
161 FIND_PACKAGE(GnuTLS REQUIRED) | 152 FIND_PACKAGE(GnuTLS REQUIRED) |
162 SET(GNUTLS_INCLUDE_DIR ${GNUTLS_INCLUDE_DIR} PARENT_SCOPE) | 153 SET(GNUTLS_INCLUDE_DIR ${GNUTLS_INCLUDE_DIR} PARENT_SCOPE) |
218 | 209 |
219 | 210 |
220 ########################## | 211 ########################## |
221 | 212 |
222 # LFDPROTO_LIBS = libraries required by the libfdproto. | 213 # LFDPROTO_LIBS = libraries required by the libfdproto. |
223 SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${IDNA_LIBRARIES} PARENT_SCOPE) | 214 SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${IDNA_LINK_LIBRARIES} PARENT_SCOPE) |
224 # And includes paths | 215 # And includes paths |
225 SET(LFDPROTO_INCLUDES ${IDNA_INCLUDE_DIR} PARENT_SCOPE) | 216 SET(LFDPROTO_INCLUDES ${IDNA_INCLUDE_DIRS} PARENT_SCOPE) |
226 # Dependencies: the libraries required by any code linking to libfdproto. | 217 # Dependencies: the libraries required by any code linking to libfdproto. |
227 SET(LFDPROTO_LINK_INTERFACES ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE) | 218 SET(LFDPROTO_LINK_INTERFACES ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE) |
228 | 219 |
229 # LFDCORE_LIBS = libraries required by the libfdcore (in addition to libfdproto and its dependencies) | 220 # LFDCORE_LIBS = libraries required by the libfdcore (in addition to libfdproto and its dependencies) |
230 SET(LFDCORE_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES} ${GCRYPT_LIBRARY} ${GNUTLS_LIBRARIES} PARENT_SCOPE) | 221 SET(LFDCORE_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES} ${GCRYPT_LIBRARY} ${GNUTLS_LIBRARIES} PARENT_SCOPE) |