[CMake] howto check for res_init() ?
Brad King
brad.king at kitware.com
Sun Jan 15 11:12:42 EST 2006
Alexander Neundorf wrote:
> Hi,
>
> I tried to check for the function res_init()
>
> with
> CHECK_FUNCTION_EXISTS(res_init HAVE_RES_INIT)
>
> This always fails, although it shouldn't.
> The problem is this line in resolv.h:
>
> /usr/include$ grep res_init *
> resolv.h:#define res_init __res_init
> resolv.h:int res_init __P((void));
>
> I.e. resolv() is only a macro, the actual function name is __res_init(),
> but the compiler/linker doesn't know this since resolv.h is not included
> when compiling the test program for CHECK_FUNCTION_EXISTS().
> So what can I do ?
Use the CheckSymbolExists module. It accounts for the possibility that
the symbol is defined by a macro.
-Brad
More information about the CMake
mailing list