[CMake] Check symbol in header files with dependencies
Alexander Koeppe
format_c at online.de
Mon Feb 9 14:02:03 EST 2015
Am 05.02.2015 um 21:12 schrieb Alexander Koeppe:
>
> Hi Cmake user list,
>
> I have a problem that I need to check the presence of a certain symbol
> in a header file using CHECK_SYMBOL_EXISTS which has several dependencies.
>
> The check fails because the header file also contains data types that
> require an additional header file to be included by the test program. It
> looks like CHECK_SYMBOL_EXISTS is not capable doing that.
Fortunately a friend of mine, Gianfranco Constamagna gave me a tip which
led me to the solution to my problem.
The link where to find the solution:
http://stackoverflow.com/questions/13611847/how-to-check-for-a-symbol-that-requires-two-header-files-in-cmake
Acutally the following code
check_symbol_exists(
IP6T_SO_ORIGINAL_DST
"netinet/in.h;net/if.h;linux/netfilter_ipv6/ip6_tables.h"
HAVE_IP6T_SO_ORIGINAL_DST
)
did the trick and transformed the semicolon seperated list of header
files to
#include <netinet/in.h>
#include <net/if.h>
#include <linux/netfilter_ipv6/ip6_tables.h>
in the test C-file. With these headers the C testfile was compiled
successfully and determined the availability of the #define variable.
I answer to my own thread to document the solution to this problem on
the place where I intentionly searched for in the 2nd instance. Maybe it
helps somebody else who face the same problem.
Greetings Alex
More information about the CMake
mailing list