option(USE_libbsd "utilize libbsd (for arc4random_buf)" OFF)\r
option(INSTALL "install expat files in cmake install target" ON)\r
\r
+if(USE_libbsd)\r
+ find_library(LIB_BSD NAMES bsd)\r
+ if(NOT LIB_BSD)\r
+ message(FATAL_ERROR "USE_libbsd option is enabled, but libbsd was not found")\r
+ else()\r
+ set(HAVE_LIBBSD TRUE)\r
+ endif()\r
+endif()\r
+\r
# configuration options\r
set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point")\r
option(XML_DTD "Define to make parameter entity parsing functionality available" ON)\r
\r
add_library(expat ${_SHARED} ${expat_SRCS})\r
if(USE_libbsd)\r
- target_link_libraries(expat bsd)\r
+ target_link_libraries(expat ${LIB_BSD})\r
endif()\r
\r
set(LIBCURRENT 7) # sync\r
check_function_exists("getrandom" HAVE_GETRANDOM)\r
\r
if(USE_libbsd)\r
- set(CMAKE_REQUIRED_LIBRARIES "bsd")\r
+ set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")\r
endif()\r
check_function_exists("arc4random_buf" HAVE_ARC4RANDOM_BUF)\r
if(NOT HAVE_ARC4RANDOM_BUF)\r
/* Define to 1 if you have the <inttypes.h> header file. */\r
#cmakedefine HAVE_INTTYPES_H\r
\r
+/* Define to 1 if you have the `bsd' library (-lbsd). */\r
+#cmakedefine HAVE_LIBBSD\r
+\r
/* Define to 1 if you have the `memmove' function. */\r
#cmakedefine HAVE_MEMMOVE\r
\r