[CMake] conflicting types for built-in function 'snprintf'
Eric Noulard
eric.noulard at gmail.com
Wed Jul 8 07:22:12 EDT 2009
2009/7/8 Steven Van Ingelgem <steven at vaningelgem.be>:
> Hi Eric,
>
>
> 1) Your first option wouldn't work because "CMAKE_REQUIRED_FLAGS" isn't
> known by neither try_compile, neither the macro.
Did you try it?
The documentation says:
CheckFunctionExists
macro which checks if the function exists
CHECK_FUNCTION_EXISTS(FUNCTION VARIABLE)
FUNCTION - the name of the function
VARIABLE - variable to store the result
The following variables may be set before calling this macro to modify
the way the check is run:
CMAKE_REQUIRED_FLAGS = string of compile command line flags
CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
CMAKE_REQUIRED_INCLUDES = list of include directories
CMAKE_REQUIRED_LIBRARIES = list of libraries to link
and the CheckFunctionExists.cmake makes use of those macros.
>
> 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).
try_compile(RESULT_VAR bindir srcfile
[CMAKE_FLAGS <Flags>]
[COMPILE_DEFINITIONS <flags> ...]
[OUTPUT_VARIABLE var]
[COPY_FILE <filename> )
thus you should be able to add "-f-no-builtin" to COMPILE_DEFINITIONS?
or may be I miss something?
The trouble I see with the "-f-no-builtin" is that the flag is GCC specific so
you must check that your compiler is GCC before adding it.
> 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.
Agreed that's ugly. I was just trying to be as exhaustive as possible :-)
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list