search_libs: add comment

This commit is contained in:
Danny Robson 2017-02-01 13:45:48 +11:00
parent 4488026028
commit 45be843568

View File

@ -1,3 +1,17 @@
###############################################################################
## Search a (possibly empty) list of libraries for the library required to link
## against a given (extern C) symbol. Pass the list of libraries as variadic
## arguments to the macro.
##
## Operates analogously to autoconfs AC_SEARCH_LIBS.
##
## If the symbol is found the variable provided will be set to the required
## library, or cleared for no library. Sets variable_FOUND to true if the
## symbol was discovered in some capacity (to differentiate between no library
## required, and the symbol not being found)
##
## Does not work for C++ symbols.
macro(search_libs _variable _symbol) macro(search_libs _variable _symbol)
if (NOT DEFINED __search_libs_${_symbol}) if (NOT DEFINED __search_libs_${_symbol})
message (STATUS "searching for ${_symbol}") message (STATUS "searching for ${_symbol}")
@ -12,7 +26,7 @@ macro(search_libs _variable _symbol)
"-DSYMBOL=${_symbol}") "-DSYMBOL=${_symbol}")
if (__search_libs_${_symbol}) if (__search_libs_${_symbol})
set (__search_libs_${_symbol}_lib) set (__search_libs_${_symbol}_lib CACHE INTERNAL "library exposing ${_symbol}")
else () else ()
foreach (lib ${ARGN}) foreach (lib ${ARGN})
if (NOT __search_libs_${_symbol}) if (NOT __search_libs_${_symbol})