mdbx-cmake: fix/refine options.

This commit is contained in:
Leonid Yuriev 2019-12-04 23:05:49 +03:00
parent df4057db6f
commit a659a7a619
2 changed files with 28 additions and 25 deletions

View File

@ -76,6 +76,8 @@ macro(add_mdbx_option NAME DESCRIPTION DEFAULT)
list(APPEND MDBX_BUILD_OPTIONS ${NAME})
if(NOT ${DEFAULT} STREQUAL "AUTO")
option(${NAME} "${DESCRIPTION}" ${DEFAULT})
elseif(NOT DEFINED ${NAME})
set(${NAME}_AUTO ON)
endif()
endmacro()
@ -283,15 +285,15 @@ else()
endif()
message(STATUS "Use C${MDBX_C_STANDARD} for libmdbx")
##############################################################################
##############################################################################
################################################################################
################################################################################
#
# #### ##### ##### # #### # # ####
# # # # # # # # # ## # #
# # # # # # # # # # # # ####
# # # ##### # # # # # # # #
# # # # # # # # # ## # #
# #### # # # #### # # ####
# #### ##### ##### # #### # # ####
# # # # # # # # # ## # #
# # # # # # # # # # # # ####
# # # ##### # # # # # # # #
# # # # # # # # # ## # #
# #### # # # #### # # ####
#
set(MDBX_BUILD_OPTIONS ENABLE_ASAN MDBX_USE_VALGRIND ENABLE_GPROF ENABLE_GCOV)
@ -316,11 +318,13 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
mark_as_advanced(MDBX_CONFIG_MANUAL_TLS_CALLBACK)
endif()
else()
add_mdbx_option(MDBX_USE_ROBUST "Use POSIX.1-2008 robust mutexes" AUTO)
mark_as_advanced(MDBX_USE_ROBUST)
add_mdbx_option(MDBX_USE_OFDLOCKS "Use Open file description locks (aka OFD locks, non-POSIX)" AUTO)
mark_as_advanced(MDBX_USE_OFDLOCKS)
endif()
add_mdbx_option(MDBX_LOCKING "Locking method (Win32=-1, SysV=5, POSIX=1988, POSIX=2001, POSIX=2008, Futexes=1995)" AUTO)
mark_as_advanced(MDBX_LOCKING)
add_mdbx_option(MDBX_TRUST_RTC "Does a system have battery-backed Real-Time Clock or just a fake." AUTO)
mark_as_advanced(MDBX_TRUST_RTC)
option(MDBX_ENABLE_TESTS "Build MDBX tests." ${BUILD_TESTING})
################################################################################

View File

@ -14,9 +14,20 @@
#cmakedefine ENABLE_ASAN
/* Common */
#cmakedefine01 MDBX_TXN_CHECKPID
#cmakedefine01 MDBX_TXN_CHECKOWNER
#cmakedefine MDBX_TXN_CHECKPID_AUTO
#ifndef MDBX_TXN_CHECKPID_AUTO
#cmakedefine01 MDBX_TXN_CHECKPID
#endif
#cmakedefine01 MDBX_BUILD_SHARED_LIBRARY
#cmakedefine MDBX_LOCKING_AUTO
#ifndef MDBX_LOCKING_AUTO
#cmakedefine MDBX_LOCKING @MDBX_LOCKING@
#endif
#cmakedefine MDBX_TRUST_RTC_AUTO
#ifndef MDBX_TRUST_RTC_AUTO
#cmakedefine01 MDBX_TRUST_RTC
#endif
/* Windows */
#cmakedefine01 MDBX_CONFIG_MANUAL_TLS_CALLBACK
@ -26,22 +37,10 @@
#cmakedefine01 MDBX_OSX_SPEED_INSTEADOF_DURABILITY
/* POSIX */
#cmakedefine01 MDBX_USE_ROBUST
#cmakedefine01 MDBX_USE_OFDLOCKS
#cmakedefine01 MDBX_DISABLE_GNU_SOURCE
/* Simulate "AUTO" values of tristate options */
#cmakedefine MDBX_TXN_CHECKPID_AUTO
#ifdef MDBX_TXN_CHECKPID_AUTO
#undef MDBX_TXN_CHECKPID
#endif
#cmakedefine MDBX_USE_ROBUST_AUTO
#ifdef MDBX_USE_ROBUST_AUTO
#undef MDBX_USE_ROBUST
#endif
#cmakedefine MDBX_USE_OFDLOCKS_AUTO
#ifdef MDBX_USE_OFDLOCKS_AUTO
#undef MDBX_USE_OFDLOCKS
#ifndef MDBX_USE_OFDLOCKS_AUTO
#cmakedefine01 MDBX_USE_OFDLOCKS
#endif
/* Build Info */