[cmake-developers] CheckTypeSize: Add support for C++

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Mon Oct 21 05:14:59 EDT 2013


On 18/10/13 16:42, Brad King wrote:
> +    if("x${arg}" MATCHES "^x(BUILTIN_TYPES_ONLY)$" AND "x${doing}" MATCHES "^x$")
> 
> Generally the convention in similar state machines elsewhere
> is to not allow a keyword to be a value for a preceding keyword,
> so you don't need the AND here.
[...]
> So the block can be (untested):
> 
>  if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY")
>    set(_CHECK_TYPE_SIZE_${arg} 1)
>    unset(doing)


This will cause

  check_type_size(int SIZEOF_INT LANGUAGE BUILTIN_TYPES_ONLY)

to be accepted by this state, while in my opinion it should report an
error. The state will change from doing=LANGUAGE to doing=unset without
setting the language, therefore C will be used and no error/warning is
shown to the user.

  AND "x${doing}" MATCHES "^x$"

was checking exactly this, in order to accept the keyword as value for
LANGUAGE and then show an unknown language "BUILTIN_TYPES_ONLY" error.

Should I just accept it and consider this correct?


Cheers,
 Daniele



More information about the cmake-developers mailing list