To get symbol getifaddrs defined you have to include both sys/types.h and ifaddrs.h. When checking whether the symbol exists, I’ve tried the following:
set (CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
check_symbol_exists (getifaddrs ifaddrs.h SP_HAVE_IFADDRS)
set (CMAKE_EXTRA_INCLUDE_FILES)
However, the test program still includes only ifaddrs.h and thus fails to detect the symbol.
How can I force it to include sys/types.h as well?
This works:
check_symbol_exists (getifaddrs “sys/types.h;ifaddrs.h” SP_HAVE_IFADDRS)