cmake: Fix detection of ssize_t/SSIZE_T

Since ssize_it is POSIX, windows/VS also have this but with BaseTsd.h, plus the
logic prefers "ssize_t" (lower) instead of "SSIZE_T" (upper) when the latest
only available -- fix this too.

Refs: #311
This commit is contained in:
Azat Khuzhin 2016-01-07 17:51:40 +03:00
parent 5b58b709b2
commit 7707f6b03a

View File

@ -420,22 +420,20 @@ CHECK_TYPE_SIZE("off_t" EVENT__SIZEOF_OFF_T LANGUAGE C)
# XXX we should functionalize these size and type sets. --elley # XXX we should functionalize these size and type sets. --elley
# Winssck. # Winssck.
set(SSIZE_TMAP_ssize_t "ssize_t") if (_MSC_VER)
set(SSIZE_TMAP_SSIZE_T "SSIZE_T") list(APPEND CMAKE_EXTRA_INCLUDE_FILES BaseTsd.h)
endif()
CHECK_TYPE_SIZE("ssize_t" EVENT__SIZEOF_SSIZE_T_LOWER LANGUAGE C)
CHECK_TYPE_SIZE("SSIZE_T" EVENT__SIZEOF_SSIZE_T_UPPER LANGUAGE C)
CHECK_TYPE_SIZE("ssize_t" EVENT__SIZEOF_SSIZE_T LANGUAGE C) if (EVENT__SIZEOF_SSIZE_T_LOWER)
CHECK_TYPE_SIZE("SSIZE_T" EVENT__SIZEOF_SSIZE_T LANGUAGE C)
if (DEFINED EVENT__SIZEOF_SSIZE_T)
if (DEFINED SSIZE_TMAP_ssize_t)
set(EVENT__ssize_t "ssize_t") set(EVENT__ssize_t "ssize_t")
elseif (DEFINED SSIZE_TMAP_SSIZE_T) elseif (EVENT__SIZEOF_SSIZE_T_UPPER)
set(EVENT__ssize_t "SSIZE_T") set(EVENT__ssize_t "SSIZE_T")
else() else()
set(EVENT__ssize_t "int") set(EVENT__ssize_t "int")
set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_INT}) set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_INT})
endif() endif()
endif()
CHECK_TYPE_SIZE(socklen_t EVENT__SIZEOF_SOCKLEN_T) CHECK_TYPE_SIZE(socklen_t EVENT__SIZEOF_SOCKLEN_T)