[CMake] How to check for a symbol that requires two header files in CMake?
Martin Sustrik
sustrik at 250bpm.com
Thu Nov 29 02:05:13 EST 2012
Hi all,
I am trying to find out whether getifaddrs function is avialable.
To get symbol getifaddrs defined you have to include both sys/types.h
and ifaddrs.h. Here's the synopsis of the function from the man page:
#include <sys/types.h>
#include <ifaddrs.h>
int getifaddrs(struct ifaddrs **ifap);
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 generated 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?
Martin
More information about the CMake
mailing list