MantisBT - CMake
View Issue Details
0010090CMakeModulespublic2010-01-04 11:452011-03-18 14:09
Andreas Schneider. 
Brad King 
normaltweakalways
closedfixed 
CMake-2-8 
 
0010090: check_prototype_definition() - Check if the protoype we expect is correct
check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)

This check if the function exists and the prototype we want to use is correct. There are still functions which have different prototypes on UNICES :(

check_prototype_definition(getpwent_r
     "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
     "NULL"
     "unistd.h;pwd.h"
     SOLARIS_GETPWENT_R)

Comments are welcome :)
No tags attached.
related to 0011565closed Kitware Robot CHECK_{FUNCTION,LIBRARY}_EXISTS() macros need a way to specify function declaration 
? CheckPrototypeDefinition.cmake (4,003) 2010-01-04 11:45
https://public.kitware.com/Bug/file/2745/CheckPrototypeDefinition.cmake
? CheckPrototypeDefinition.c.in (514) 2010-01-04 11:46
https://public.kitware.com/Bug/file/2746/CheckPrototypeDefinition.c.in
patch 0002-Added-a-check-to-verify-that-a-protoype-we-expect-is.patch (5,994) 2010-03-11 05:16
https://public.kitware.com/Bug/file/2956/0002-Added-a-check-to-verify-that-a-protoype-we-expect-is.patch
Issue History
2010-01-04 11:45Andreas Schneider.New Issue
2010-01-04 11:45Andreas Schneider.File Added: CheckPrototypeDefinition.cmake
2010-01-04 11:46Andreas Schneider.File Added: CheckPrototypeDefinition.c.in
2010-03-11 05:16Andreas Schneider.File Added: 0002-Added-a-check-to-verify-that-a-protoype-we-expect-is.patch
2011-01-17 14:33David ColeAssigned To => Brad King
2011-01-17 14:33David ColeStatusnew => assigned
2011-01-17 14:34David ColeNote Added: 0024791
2011-01-17 14:34David ColeRelationship addedrelated to 0011565
2011-01-17 15:01Brad KingNote Added: 0024797
2011-02-10 12:43Andreas Schneider.Note Added: 0025376
2011-02-10 12:43Andreas Schneider.Note Added: 0025377
2011-03-18 09:15Andreas Schneider.Note Added: 0025803
2011-03-18 14:07Brad KingNote Added: 0025818
2011-03-18 14:09Brad KingStatusassigned => closed
2011-03-18 14:09Brad KingResolutionopen => fixed

Notes
(0024791)
David Cole   
2011-01-17 14:34   
A worthy addition? Better than what we have now?
(0024797)
Brad King   
2011-01-17 15:01   
Yes, this is interesting.

It looks like the implementation depends on the compiler to complain if the specified prototype does not match the original declaration in the header file. What happens if the system header actually defines the "function" as a macro?
(0025376)
Andreas Schneider.   
2011-02-10 12:43   
Well this only works for functions and it is looking for the symbol. Normally these functions you're looking for aren't macros and it is a bad idea to have them as a macro cause you can't dlsym() them.
(0025377)
Andreas Schneider.   
2011-02-10 12:43   
IIRC this is more or less the same what the autofools do.
(0025803)
Andreas Schneider.   
2011-03-18 09:15   
Pushed to the staging server with a test case. Waiting for review!
(0025818)
Brad King   
2011-03-18 14:07   
Merged to next, thanks:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f252abe [^]
  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93c56a70 [^]
  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=030f83de [^]