[CMake] Autotools->cmake: Are these checks really needed anymore?

Chuck Atkins chuck.atkins at kitware.com
Sat Aug 30 11:32:01 EDT 2014


On Sat, Aug 30, 2014 at 10:30 AM, Rolf Eike Beer <eike at sf-mail.de> wrote:

> > # Checks for typedefs, structures, and compiler characteristics.
> > #AC_C_CONST
> > #AC_C_INLINE
> ...
> > #AC_TYPE_SIZE_T
> ...
>
> #AC_C_RESTRICT
> > #AC_C_VOLATILE
>

These should be generally safe to assume


> #AC_STRUCT_TM
> > #AC_HEADER_TIME
>

Unless you're targeting embedded systems and / or microcontrollors then you
shouldn't have a problem with these either, even still there's a good
chance you'd have it.


> #AC_TYPE_INT16_T
> > #AC_TYPE_INT32_T
> > #AC_TYPE_INT64_T
> > #AC_TYPE_INT8_T
> > #AC_TYPE_UINT16_T
> > #AC_TYPE_UINT32_T
> > #AC_TYPE_UINT64_T
> > #AC_TYPE_UINT8_T
>
> This is basically "is there a usable <stdint.h>" or <cstdint>. The latter
> you
> will find in newer versions of MSVC and everything else that understands
> recent
> C++, the former in every compiler supporting at least a decent level of
> C99,
> which _excludes_ MSVC for policy reasons that even MS will probably find
> hard
> to explain. So you usually don't check for these types but for the header.
>

Ugh, this is definitely one of those irritating Windows-isms. cstdint is
guaranteed available in C++11, so if you require that then most of this
goes away. stdint.h, as Rolf mentioned, wasn't available until VS2010, so
if you can place that as a requirement then you're all set. You can
restrict this in your top level cmake with something like this:

if(MSVC_VERSION LESS 1700)
  message(FATAL_ERROR "Only Visual C++ 2010 or greater is supported")
endif()

However, if you do have to support older MSVC versions then this is a
problem and you will need to either redefine the types or include your own
stdint.h (bringing the header is usally easier), a commonly used one by
numerous projects for porting unix -> windows can be found here:
https://code.google.com/p/msinttypes/source/browse/trunk/stdint.h.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140830/dd2ee5d4/attachment.html>


More information about the CMake mailing list