[cmake-developers] CheckStructHasMember does not support C++ only structs

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Mon Sep 23 10:35:11 EDT 2013


Sorry disregard my previous mail...
My problem was actually different and the attached patch didn't work...

Regards,
 Daniele

On 23/09/13 10:27, Daniele E. Domenichelli wrote:
> Hello,
> 
> CheckStructHasMember does not support C++ only structs. If headers
> required to check if a struct has a member can be compiled with C++
> compiler only, the check will fail, because the C compiler will fail. As
> a consequence, the result variable is set to false, even if the struct
> has that particular member.
> 
> The attached patch adds 2 new macros:
>  - CHECK_CXX_STRUCT_HAS_MEMBER (similar to CHECK_STRUCT_HAS_MEMBER but
> uses the C++ compiler)
>  - CHECK_C_STRUCT_HAS_MEMBER (identical to CHECK_STRUCT_HAS_MEMBER,
> added for symmetry)
> that can be used to check a struct, choosing the compiler to use.
> 
> I'm not sure if this is the right way to fix this (i.e. if
> CHECK_C_STRUCT_HAS_MEMBER is required), or if it is a better idea to add
> a parameter to the existing macro.
> What do you think?
> 
> 
> Cheers,
>  Daniele
> 




More information about the cmake-developers mailing list