3 # The problem with this library is that it is built-in in the Linux glib,
4 # while on systems like FreeBSD, it is installed separately and thus needs to be linked to.
5 # Therefore, we search for the header to see if the it's available in the first place.
6 # If it is available, we try to locate the library to figure out whether it is built-in or not.
8 find_path(EXECINFO_INCLUDES "execinfo.h")
11 # We found the header file's include dir.
13 # Now determine if it's built-in or not, by searching the library file.
14 find_library(EXECINFO_LIBRARIES "execinfo")
16 if(NOT EXECINFO_LIBRARIES)
17 # Built-in, no further action is needed
18 set(EXECINFO_LIBRARIES "")
19 message(STATUS "Found execinfo (built-in)")
21 # It's an external library.
22 message(STATUS "Found execinfo: ${EXECINFO_LIBRARIES}")
25 set(EXECINFO_FOUND true)