[CMake] CHECK_FUNCTION_EXISTS question

Eric Noulard eric.noulard at gmail.com
Tue Apr 22 16:01:47 EDT 2008


2008/4/22, Mathieu Malaterre <mathieu.malaterre at gmail.com>:
> Hi there,
>
>   If I understand correctly CHECK_FUNCTION_EXISTS is only checking
>  that the c symbol passed to the CHECK_FUNCTION_EXISTS macro can be
>  found by the linker, right ? I have a case where the symbol (namely
>  _snprintf) can be found, but the C declaration is not found in
>  cygwin-stdio.h (in which case I need to use snprintf declaration).
>
>   Is this correct ? If so is there a way to detect if a function can
>  be found in a particular header ?

I don't know but....

The TRY_COMPILE statement inside CheckFunctionExists.cmake
should generate a warning about that?

May be (not tested)
turning warning to error will make CHECK_FUNCTION_EXISTS to fail?

For GCC this could be
SET(CMAKE_REQUIRED_FLAGS "-Werror")

but this is not portable :-(

-- 
Erk


More information about the CMake mailing list