From 81dca1f7e9d1e5251b73fc3b44c9cded45e9a5c8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 7 Apr 2020 23:06:18 +0300 Subject: [PATCH] mdbx-cmake: add MDBX_BUILD_TOOLS option. Change-Id: Ib6329fdea66dd52720021b80a6fecdaa078ceb2b --- CMakeLists.txt | 22 ++++++++++++---------- src/CMakeLists.txt | 4 +++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e67cdbe9..42075d64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ ## cmake_minimum_required(VERSION 3.8.2) + cmake_policy(PUSH) cmake_policy(VERSION 3.8.2) if(NOT CMAKE_VERSION VERSION_LESS 3.13) @@ -72,15 +73,6 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() -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() - # only for compatibility testing # set(CMAKE_CXX_STANDARD 14) @@ -285,6 +277,15 @@ else() endif() message(STATUS "Use C${MDBX_C_STANDARD} for libmdbx") +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() + ################################################################################ ################################################################################ # @@ -298,6 +299,7 @@ message(STATUS "Use C${MDBX_C_STANDARD} for libmdbx") set(MDBX_BUILD_OPTIONS ENABLE_ASAN MDBX_USE_VALGRIND ENABLE_GPROF ENABLE_GCOV) add_mdbx_option(MDBX_BUILD_SHARED_LIBRARY "Build libmdbx as shared library (DLL)" ${BUILD_SHARED_LIBS}) +add_mdbx_option(MDBX_BUILD_TOOLS "Build MDBX tools (mdbx_chk/stat/dump/load/copy)" ON) add_mdbx_option(MDBX_ALLOY_BUILD "Build MDBX library as single object file" ON) add_mdbx_option(MDBX_TXN_CHECKOWNER "Checking transaction matches the calling thread inside libmdbx's API" ON) add_mdbx_option(MDBX_TXN_CHECKPID "Paranoid checking PID inside libmdbx's API" AUTO) @@ -325,8 +327,8 @@ add_mdbx_option(MDBX_LOCKING "Locking method (Win32=-1, SysV=5, POSIX=1988, POSI 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}) option(MDBX_FORCE_ASSERTIONS "Force enable assertion checking." OFF) +option(MDBX_ENABLE_TESTS "Build MDBX tests." ${BUILD_TESTING}) ################################################################################ ################################################################################ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a33ede3..c2fe7853 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -260,4 +260,6 @@ if(MDBX_BUILD_SHARED_LIBRARY) endif() endif() -add_subdirectory(tools) +if(MDBX_BUILD_TOOLS) + add_subdirectory(tools) +endif()