Check for ssize_t properly

This commit is contained in:
klondike 2013-08-31 17:44:55 +02:00 committed by Jan Vidar Krey
parent 5c8d99d8ff
commit b8209d9d0a
2 changed files with 12 additions and 2 deletions

View File

@ -27,6 +27,8 @@ find_package(Sqlite3)
include(TestBigEndian) include(TestBigEndian)
include(CheckSymbolExists) include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckTypeSize)
#Some functions need this to be found #Some functions need this to be found
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
@ -62,6 +64,11 @@ if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif() endif()
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
if (HAVE_SYS_TYPES_H)
set (CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "sys/types.h")
endif()
check_type_size( ssize_t SSIZE_T )
check_symbol_exists(memmem string.h HAVE_MEMMEM) check_symbol_exists(memmem string.h HAVE_MEMMEM)
check_symbol_exists(strndup string.h HAVE_STRNDUP) check_symbol_exists(strndup string.h HAVE_STRNDUP)

View File

@ -34,7 +34,6 @@
#endif #endif
#if defined(__CYGWIN__) || defined(__MINGW32__) #if defined(__CYGWIN__) || defined(__MINGW32__)
#define HAVE_SSIZE_T
#define NEED_GETOPT #define NEED_GETOPT
#endif #endif
@ -69,6 +68,10 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#cmakedefine HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if !defined(WIN32) #if !defined(WIN32)
#include <inttypes.h> #include <inttypes.h>
#include <unistd.h> #include <unistd.h>
@ -77,10 +80,10 @@
#include <sys/resource.h> #include <sys/resource.h>
#define HAVE_DLOPEN #define HAVE_DLOPEN
#define HAVE_GETOPT #define HAVE_GETOPT
#define HAVE_SSIZE_T
#include <dlfcn.h> #include <dlfcn.h>
#define HAVE_GETRLIMIT #define HAVE_GETRLIMIT
#endif #endif
#cmakedefine HAVE_SSIZE_T
#cmakedefine HAVE_STRNDUP #cmakedefine HAVE_STRNDUP
#cmakedefine HAVE_MEMMEM #cmakedefine HAVE_MEMMEM