mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 13:24:43 -04:00
Merge pull request #305 from libevent/cmake_updates
CMake updates that fix things I thought I fixed.
This commit is contained in:
commit
bcc8f0f1c2
@ -34,12 +34,12 @@ project(libevent C)
|
|||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
|
|
||||||
|
include(CheckTypeSize)
|
||||||
include(CheckFunctionExistsEx)
|
include(CheckFunctionExistsEx)
|
||||||
include(CheckFileOffsetBits)
|
include(CheckFileOffsetBits)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckTypeSize)
|
|
||||||
include(CheckVariableExists)
|
include(CheckVariableExists)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
include(CheckStructHasMember)
|
include(CheckStructHasMember)
|
||||||
@ -54,6 +54,7 @@ event_fuzzy_version_from_git()
|
|||||||
set(EVENT_VERSION_MAJOR ${EVENT_GIT___VERSION_MAJOR})
|
set(EVENT_VERSION_MAJOR ${EVENT_GIT___VERSION_MAJOR})
|
||||||
set(EVENT_VERSION_MINOR ${EVENT_GIT___VERSION_MINOR})
|
set(EVENT_VERSION_MINOR ${EVENT_GIT___VERSION_MINOR})
|
||||||
set(EVENT_VERSION_PATCH ${EVENT_GIT___VERSION_PATCH})
|
set(EVENT_VERSION_PATCH ${EVENT_GIT___VERSION_PATCH})
|
||||||
|
set(EVENT_VERSION_STAGE ${EVENT_GIT___VERSION_STAGE})
|
||||||
|
|
||||||
|
|
||||||
set(EVENT_ABI_MAJOR ${EVENT_VERSION_MAJOR})
|
set(EVENT_ABI_MAJOR ${EVENT_VERSION_MAJOR})
|
||||||
@ -69,8 +70,8 @@ set(EVENT_PACKAGE_VERSION
|
|||||||
set(EVENT_NUMERIC_VERSION 0x02010500)
|
set(EVENT_NUMERIC_VERSION 0x02010500)
|
||||||
|
|
||||||
# only a subset of names can be used, defaults to "beta"
|
# only a subset of names can be used, defaults to "beta"
|
||||||
set(EVENT__STAGE_NAME "${EVENT_GIT___VERSION_STAGE}"
|
set(EVENT_STAGE_NAME ${EVENT_VERSION_STAGE}
|
||||||
CACHE STRING "set EVENT_STAGE_NAM")
|
CACHE STRING "set EVENT_STAGE_NAME")
|
||||||
|
|
||||||
# a list that defines what can set for EVENT_STAGE_VERSION
|
# a list that defines what can set for EVENT_STAGE_VERSION
|
||||||
set(EVENT__ALLOWED_STAGE_NAMES
|
set(EVENT__ALLOWED_STAGE_NAMES
|
||||||
@ -84,15 +85,15 @@ set(EVENT__ALLOWED_STAGE_NAMES
|
|||||||
# EVENT__STAGE_RET
|
# EVENT__STAGE_RET
|
||||||
|
|
||||||
list(FIND EVENT__ALLOWED_STAGE_NAMES
|
list(FIND EVENT__ALLOWED_STAGE_NAMES
|
||||||
${EVENT__STAGE_NAME}
|
${EVENT_STAGE_NAME}
|
||||||
EVENT__STAGE_RET)
|
EVENT__STAGE_RET)
|
||||||
|
|
||||||
if (EVENT__STAGE_RET EQUAL "-1")
|
if (EVENT_STAGE_RET EQUAL "-1")
|
||||||
set(EVENT__STAGE_NAM "beta")
|
set(EVENT_STAGE_NAME "beta")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(EVENT_VERSION
|
set(EVENT_VERSION
|
||||||
"${EVENT_VERSION_MAJOR}.${EVENT_VERSION_MINOR}.${EVENT_VERSION_PATCH}-${EVENT_STAGE_NAM}")
|
"${EVENT_VERSION_MAJOR}.${EVENT_VERSION_MINOR}.${EVENT_VERSION_PATCH}-${EVENT_STAGE_NAME}")
|
||||||
|
|
||||||
option(EVENT__BUILD_SHARED_LIBRARIES
|
option(EVENT__BUILD_SHARED_LIBRARIES
|
||||||
"Define if libevent should be built with shared libraries instead of archives" OFF)
|
"Define if libevent should be built with shared libraries instead of archives" OFF)
|
||||||
@ -404,35 +405,42 @@ CHECK_SYMBOL_EXISTS(RANDOM_UUID sys/sysctl.h EVENT__HAVE_DECL_RANDOM_UUID)
|
|||||||
CHECK_SYMBOL_EXISTS(F_SETFD fcntl.h EVENT__HAVE_SETFD)
|
CHECK_SYMBOL_EXISTS(F_SETFD fcntl.h EVENT__HAVE_SETFD)
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(fd_mask EVENT__HAVE_FD_MASK)
|
CHECK_TYPE_SIZE(fd_mask EVENT__HAVE_FD_MASK)
|
||||||
CHECK_TYPE_SIZE(size_t EVENT__SIZEOF_SIZE_T)
|
|
||||||
|
|
||||||
|
CHECK_TYPE_SIZE(size_t EVENT__SIZEOF_SIZEE_T)
|
||||||
if(NOT EVENT__SIZEOF_SIZE_T)
|
if(NOT EVENT__SIZEOF_SIZE_T)
|
||||||
set(EVENT__size_t unsigned)
|
set(EVENT__size_t "unsigned")
|
||||||
# and the point is???
|
|
||||||
set(EVENT__SIZEOF_SIZE_T ${EVENT__SIZEOF_UNSIGNED})
|
set(EVENT__SIZEOF_SIZE_T ${EVENT__SIZEOF_UNSIGNED})
|
||||||
else()
|
else()
|
||||||
set(EVENT__size_t "size_t")
|
set(EVENT__size_t size_t)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("off_t" EVENT__SIZEOF_OFF_T)
|
CHECK_TYPE_SIZE("off_t" EVENT__SIZEOF_OFF_T LANGUAGE C)
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(ssize_t EVENT__SIZEOF_SSIZE_T)
|
|
||||||
CHECK_TYPE_SIZE(SSIZE_T EVENT__SIZEOF_UPPERCASE_SSIZE_T)
|
# XXX we should functionalize these size and type sets. --elley
|
||||||
# Winsock.
|
|
||||||
if(NOT EVENT__SIZEOF_SSIZE_T)
|
# Winssck.
|
||||||
if(EVENT__SIZEOF_UPPERCASE_SSIZE_T)
|
set(SSIZE_TMAP_ssize_t "ssize_t")
|
||||||
set(EVENT__ssize_t SSIZE_T)
|
set(SSIZE_TMAP_SSIZE_T "SSIZE_T")
|
||||||
set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_UPPERCASE_SSIZE_T})
|
|
||||||
else()
|
CHECK_TYPE_SIZE("ssize_t" EVENT__SIZEOF_SSIZE_T LANGUAGE C)
|
||||||
set(EVENT__ssize_t int)
|
CHECK_TYPE_SIZE("SSIZE_T" EVENT__SIZEOF_SSIZE_T LANGUAGE C)
|
||||||
set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_INT})
|
|
||||||
endif()
|
if (DEFINED EVENT__SIZEOF_SSIZE_T)
|
||||||
|
if (DEFINED SSIZE_TMAP_ssize_t)
|
||||||
|
set(EVENT__ssize_t "ssize_t")
|
||||||
|
elseif (DEFINED SSIZE_TMAP_SSIZE_T)
|
||||||
|
set(EVENT__ssize_t "SSIZE_T")
|
||||||
|
else()
|
||||||
|
set(EVENT__ssize_t "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)
|
||||||
if(NOT EVENT__SIZEOF_SOCKLEN_T)
|
if(NOT EVENT__SIZEOF_SOCKLEN_T)
|
||||||
set(EVENT__socklen_t "unsigned int")
|
set(EVENT__socklen_t "unsigned int")
|
||||||
# what is the poitn of this if EVENT__SIZEOF_UNSIGNED_INT is 0?
|
|
||||||
set(EVENT__SIZEOF_SOCKLEN_T ${EVENT__SIZEOF_UNSIGNED_INT})
|
set(EVENT__SIZEOF_SOCKLEN_T ${EVENT__SIZEOF_UNSIGNED_INT})
|
||||||
else()
|
else()
|
||||||
set(EVENT__socklen_t "socklen_t")
|
set(EVENT__socklen_t "socklen_t")
|
||||||
@ -440,8 +448,11 @@ endif()
|
|||||||
|
|
||||||
CHECK_TYPE_SIZE(pid_t EVENT__SIZEOF_PID_T)
|
CHECK_TYPE_SIZE(pid_t EVENT__SIZEOF_PID_T)
|
||||||
if(NOT EVENT__SIZEOF_PID_T)
|
if(NOT EVENT__SIZEOF_PID_T)
|
||||||
set(EVENT__pid_t int)
|
set(EVENT__pid_t "int")
|
||||||
set(EVENT__SIZEOF_PID_T ${EVENT__SIZEOF_INT})
|
set(EVENT__SIZEOF_PID_T ${EVENT__SIZEOF_INT})
|
||||||
|
else()
|
||||||
|
set(EVENT__pid_t "pid_t")
|
||||||
|
set(EVENT__SIZEOF_PID_T EVENT__SIZEOF_PID_T)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
|
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
|
||||||
@ -452,6 +463,7 @@ if(EVENT__HAVE_CLOCK_GETTIME)
|
|||||||
set(EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1)
|
set(EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# we're just getting lazy now.
|
||||||
CHECK_TYPE_SIZE("uintptr_t" EVENT__HAVE_UINTPTR_T)
|
CHECK_TYPE_SIZE("uintptr_t" EVENT__HAVE_UINTPTR_T)
|
||||||
CHECK_TYPE_SIZE("void *" EVENT__SIZEOF_VOID_P)
|
CHECK_TYPE_SIZE("void *" EVENT__SIZEOF_VOID_P)
|
||||||
|
|
||||||
@ -491,7 +503,6 @@ endif()
|
|||||||
|
|
||||||
# Check for sockaddr structure sizes.
|
# Check for sockaddr structure sizes.
|
||||||
set(SOCKADDR_HEADERS)
|
set(SOCKADDR_HEADERS)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
|
set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
|
||||||
if (_MSC_VER LESS 1300)
|
if (_MSC_VER LESS 1300)
|
||||||
|
@ -44,10 +44,10 @@ macro(event_fuzzy_version_from_git)
|
|||||||
GITVERSION)
|
GITVERSION)
|
||||||
|
|
||||||
if (GITRET EQUAL 0)
|
if (GITRET EQUAL 0)
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)$" "\\1" EVENT_GIT___VERSION_MAJOR ${GITVERSION})
|
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\1" EVENT_GIT___VERSION_MAJOR ${GITVERSION})
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)$" "\\2" EVENT_GIT___VERSION_MINOR ${GITVERSION})
|
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\2" EVENT_GIT___VERSION_MINOR ${GITVERSION})
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)$" "\\3" EVENT_GIT___VERSION_PATCH ${GITVERSION})
|
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\3" EVENT_GIT___VERSION_PATCH ${GITVERSION})
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)$" "\\4" EVENT_GIT___VERSION_STAGE ${GITVERSION})
|
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-([aA-zZ]+)" "\\4" EVENT_GIT___VERSION_STAGE ${GITVERSION})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
#define EVENT__NUMERIC_VERSION @EVENT_NUMERIC_VERSION@
|
#define EVENT__NUMERIC_VERSION @EVENT_NUMERIC_VERSION@
|
||||||
#define EVENT__PACKAGE_VERSION "@EVENT_PACKAGE_VERSION@"
|
#define EVENT__PACKAGE_VERSION "@EVENT_PACKAGE_VERSION@"
|
||||||
|
|
||||||
|
#define EVENT__VERSION_MAJOR @EVENT_VERSION_MAJOR@
|
||||||
|
#define EVENT__VERSION_MINOR @EVENT_VERSION_MINOR@
|
||||||
|
#define EVENT__VERSION_PATCH @EVENT_VERSION_PATCH@
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define EVENT__VERSION "@EVENT_VERSION@"
|
#define EVENT__VERSION "@EVENT_VERSION@"
|
||||||
|
|
||||||
@ -436,22 +440,25 @@
|
|||||||
#define EVENT__SIZEOF_PTHREAD_T @EVENT__SIZEOF_PTHREAD_T@
|
#define EVENT__SIZEOF_PTHREAD_T @EVENT__SIZEOF_PTHREAD_T@
|
||||||
|
|
||||||
/* The size of a `int', as computed by sizeof. */
|
/* The size of a `int', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_INT @EVENT__SIZEOF_INT@
|
#define EVENT__SIZEOF_INT @EVENT__SIZEOF_INT@
|
||||||
|
|
||||||
/* The size of a `long', as computed by sizeof. */
|
/* The size of a `long', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_LONG @EVENT__SIZEOF_LONG@
|
#define EVENT__SIZEOF_LONG @EVENT__SIZEOF_LONG@
|
||||||
|
|
||||||
/* The size of a `long long', as computed by sizeof. */
|
/* The size of a `long long', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_LONG_LONG @EVENT__SIZEOF_LONG_LONG@
|
#define EVENT__SIZEOF_LONG_LONG @EVENT__SIZEOF_LONG_LONG@
|
||||||
|
|
||||||
/* The size of `off_t', as computed by sizeof. */
|
/* The size of `off_t', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_OFF_T ${EVENT__SIZEOF_OFF_T}
|
#define EVENT__SIZEOF_OFF_T @EVENT__SIZEOF_OFF_T@
|
||||||
|
|
||||||
|
#define EVENT__SIZEOF_SSIZE_T @EVENT__SIZEOF_SSIZE_T@
|
||||||
|
|
||||||
|
|
||||||
/* The size of a `short', as computed by sizeof. */
|
/* The size of a `short', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_SHORT @EVENT__SIZEOF_SHORT@
|
#define EVENT__SIZEOF_SHORT @EVENT__SIZEOF_SHORT@
|
||||||
|
|
||||||
/* The size of `size_t', as computed by sizeof. */
|
/* The size of `size_t', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_SIZE_T @EVENT__SIZEOF_SIZE_T@
|
#define EVENT__SIZEOF_SIZE_T @EVENT__SIZEOF_SIZE_T@
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#cmakedefine EVENT__STDC_HEADERS
|
#cmakedefine EVENT__STDC_HEADERS
|
||||||
@ -460,10 +467,10 @@
|
|||||||
#cmakedefine EVENT__TIME_WITH_SYS_TIME
|
#cmakedefine EVENT__TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
/* The size of `socklen_t', as computed by sizeof. */
|
/* The size of `socklen_t', as computed by sizeof. */
|
||||||
#cmakedefine EVENT__SIZEOF_SOCKLEN_T @EVENT__SIZEOF_SOCKLEN_T@
|
#define EVENT__SIZEOF_SOCKLEN_T @EVENT__SIZEOF_SOCKLEN_T@
|
||||||
|
|
||||||
/* The size of 'void *', as computer by sizeof */
|
/* The size of 'void *', as computer by sizeof */
|
||||||
#cmakedefine EVENT__SIZEOF_VOID_P @EVENT__SIZEOF_VOID_P@
|
#define EVENT__SIZEOF_VOID_P @EVENT__SIZEOF_VOID_P@
|
||||||
|
|
||||||
/* set an alias for whatever __func__ __FUNCTION__ is, what sillyness */
|
/* set an alias for whatever __func__ __FUNCTION__ is, what sillyness */
|
||||||
#if defined (__func__)
|
#if defined (__func__)
|
||||||
@ -508,18 +515,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define to `int' if <sys/tyes.h> does not define. */
|
/* Define to `int' if <sys/tyes.h> does not define. */
|
||||||
#cmakedefine EVENT__pid_t @EVENT__pid_t@
|
#define EVENT__pid_t @EVENT__pid_t@
|
||||||
|
|
||||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
#cmakedefine EVENT__size_t @EVENT__size_t@
|
#define EVENT__size_t @EVENT__size_t@
|
||||||
|
|
||||||
/* Define to unsigned int if you dont have it */
|
/* Define to unsigned int if you dont have it */
|
||||||
#cmakedefine EVENT__socklen_t @EVENT__socklen_t@
|
#define EVENT__socklen_t @EVENT__socklen_t@
|
||||||
|
|
||||||
/* Define to `int' if <sys/types.h> does not define. */
|
/* Define to `int' if <sys/types.h> does not define. */
|
||||||
#cmakedefine EVENT__ssize_t @EVENT__ssize_t@
|
#define EVENT__ssize_t @EVENT__ssize_t@
|
||||||
|
|
||||||
#cmakedefine EVENT__NEED_DLLIMPORT @EVENT__NEED_DLLIMPORT@
|
#define EVENT__NEED_DLLIMPORT @EVENT__NEED_DLLIMPORT@
|
||||||
|
|
||||||
/* Define to 1 if you have ERR_remove_thread_stat(). */
|
/* Define to 1 if you have ERR_remove_thread_stat(). */
|
||||||
#cmakedefine EVENT__HAVE_ERR_REMOVE_THREAD_STATE
|
#cmakedefine EVENT__HAVE_ERR_REMOVE_THREAD_STATE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user