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

Brad King brad.king at kitware.com
Fri Oct 18 10:42:19 EDT 2013


On 10/18/2013 10:20 AM, Daniele E. Domenichelli wrote:
> Done and added a few more unit tests...

Thanks:

+    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.  Also Eike has made an effort to
avoid MATCHES in favor of STREQUAL when possible for speed.

So the block can be (untested):

 if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY")
   set(_CHECK_TYPE_SIZE_${arg} 1)
   unset(doing)
 elseif("x${arg}" STREQUAL "xLANGUAGE") # change to MATCHES for more keys
   set(doing "${arg}")
 elseif("x${doing}" STREQUAL "xLANGUAGE")
   set(_CHECK_TYPE_SIZE_${doing} "${arg}")
   unset(doing)
 else()
   message(FATAL_ERROR "Unknown argument:\n  ${arg}\n")
 endif()

-Brad



More information about the cmake-developers mailing list