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

Eric Noulard eric.noulard at gmail.com
Wed Jul 8 08:46:10 EDT 2009


2009/7/8 Steven Van Ingelgem <steven at vaningelgem.be>:
>
>
> 2009/7/8 Eric Noulard <eric.noulard at gmail.com>
>
> -fno-builtin is not a definition, and try_compile (following the cmake docs)
> will add it to "add_definitions()", maybe it will work, but I think that's
> also not a very clean solution ;).
> I tried your solution, but I didn't see the parameter added into the error
> log... So I think CMake only takes parameters starting with -D and /D?

That would definitely be a CMake bug,

CMAKE_REQUIRED_FLAGS = string of compile command line flags
CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)

CMAKE_REQUIRED_DEFINITIONS should  only work with -DBLAH=<blahval>

but
CMAKE_REQUIRED_FLAGS should accept any compile flags.

Would you try the attached project.
It works for me and the CMakeFiles/CMakeOutput.log reads:

Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o
/usr/bin/gcc  -DWHAT=ever -DCHECK_FUNCTION_EXISTS=snprintf
-fno-builtin   -o
CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o   -c
/home/eric/CMake/cmake-V2_6/share/cmake-2.6/Modules/CheckFunctionExists.c

which is the expect command line.

However my test env is Linux + gcc 4.3.2.
May be you can try that on your side?

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMCheckWhatEver.zip
Type: application/zip
Size: 794 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090708/2c5b45ed/attachment-0001.zip>


More information about the CMake mailing list