[CMake] conflicting types for built-in function 'snprintf'

Steven Van Ingelgem steven at vaningelgem.be
Wed Jul 8 07:10:47 EDT 2009


Hi Eric,


1) Your first option wouldn't work because "CMAKE_REQUIRED_FLAGS" isn't
known by neither try_compile, neither the macro.

2) Wouldn't work either because try_compile doesn't take command line
parameters (at least not in this form & unless you will construct the
makefile from hand inside this script).

3) I think this is the only feasible way in fact... Although I find this the
least nicest way, and as such I didn't try that one.


Grtz,
Steven

2009/7/8 Eric Noulard <eric.noulard at gmail.com>

> 2009/7/8 Steven Van Ingelgem <steven at vaningelgem.be>:
> > Hi,
> >
> >
> > I tried this call:
> > CHECK_FUNCTION_EXISTS(snprintf  HAS_snprintf)
> >
> >
> > Which results in this error being generated:
> > C:\MinGW\bin\gcc.exe   -g -ggdb -O0 -Wall -Werror
> > -DCHECK_FUNCTION_EXISTS=snprintf   -o
> > CMakeFiles\cmTryCompileExec.dir\CheckFunctionExists.c.obj   -c
> "C:\Program
> > Files\CMake 2.7\share\cmake-2.7\Modules\CheckFunctionExists.c"
> > cc1.exe: warnings being treated as errors
> > C:\Program Files\CMake
> 2.7\share\cmake-2.7\Modules\CheckFunctionExists.c:3:
> > error: conflicting types for built-in function 'snprintf'
> >
> >
> > What I understand is that the snprintf type exists, but conflicts with
> the
> > built-in version... So this should return 'true' in fact...
> >
> > What can I do about it?
>
> Disable builtin support with
> SET(CMAKE_REQUIRED_FLAGS "-fno-builtin")
> see:
> http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/C-Dialect-Options.html#C-Dialect-Options
>
> or
>
> update CheckFunctionExists.cmake in order to make it try builtin first?
>
> or
>
> update CheckFunctionExists.cmake in order to make it catch the
> "conflicting types for built-in function"
> and return true in this case?
>
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090708/96246173/attachment.htm>


More information about the CMake mailing list