mdbx-cmake: minor refine MDBX_BUILD_TARGET/MDBX_BUILD_TYPE, etc.

Change-Id: I34f99c50ced56b310576743c56422a1e1992c03b
This commit is contained in:
Leonid Yuriev 2020-09-28 23:47:37 +03:00
parent 11b410dcfe
commit 10c50aaf2e
2 changed files with 16 additions and 5 deletions

View File

@ -104,7 +104,7 @@ if(MDBX_AMALGAMATED_SOURCE AND DEFINED MDBX_ENABLE_TESTS AND MDBX_ENABLE_TESTS)
endif() endif()
# Try to find a C++ compiler unless sure that this is unnecessary. # Try to find a C++ compiler unless sure that this is unnecessary.
if (NOT CMAKE_CXX_COMPILER) if (NOT CMAKE_CXX_COMPILER_LOADED)
include(CheckLanguage) include(CheckLanguage)
if(NOT DEFINED MDBX_BUILD_CXX OR MDBX_BUILD_CXX if(NOT DEFINED MDBX_BUILD_CXX OR MDBX_BUILD_CXX
OR (NOT MDBX_AMALGAMATED_SOURCE AND (NOT DEFINED MDBX_ENABLE_TESTS OR MDBX_ENABLE_TESTS))) OR (NOT MDBX_AMALGAMATED_SOURCE AND (NOT DEFINED MDBX_ENABLE_TESTS OR MDBX_ENABLE_TESTS)))
@ -456,7 +456,7 @@ else()
unset(MDBX_LINK_TOOLS_NONSTATIC CACHE) unset(MDBX_LINK_TOOLS_NONSTATIC CACHE)
endif() endif()
if(CMAKE_CXX_COMPILER AND MDBX_CXX_STANDARD GREATER_EQUAL 11 AND MDBX_CXX_STANDARD LESS 83) if(CMAKE_CXX_COMPILER_LOADED AND MDBX_CXX_STANDARD GREATER_EQUAL 11 AND MDBX_CXX_STANDARD LESS 83)
if(NOT MDBX_AMALGAMATED_SOURCE) if(NOT MDBX_AMALGAMATED_SOURCE)
option(MDBX_ENABLE_TESTS "Build MDBX tests" ${BUILD_TESTING}) option(MDBX_ENABLE_TESTS "Build MDBX tests" ${BUILD_TESTING})
endif() endif()
@ -476,7 +476,7 @@ endif()
################################################################################ ################################################################################
################################################################################ ################################################################################
if(MDBX_BUILD_CXX AND NOT CMAKE_CXX_COMPILER) if(MDBX_BUILD_CXX AND NOT CMAKE_CXX_COMPILER_LOADED)
message(FATAL_ERROR "MDBX_BUILD_CXX=${MDBX_BUILD_CXX}: The C++ compiler is required to build the C++API.") message(FATAL_ERROR "MDBX_BUILD_CXX=${MDBX_BUILD_CXX}: The C++ compiler is required to build the C++API.")
endif() endif()
@ -788,13 +788,14 @@ endif()
# provide build-type # provide build-type
if(CMAKE_CONFIGURATION_TYPES) if(CMAKE_CONFIGURATION_TYPES)
# via per-configuration define
add_definitions(-DMDBX_BUILD_TYPE="$<CONFIG>") add_definitions(-DMDBX_BUILD_TYPE="$<CONFIG>")
else() else()
set(MDBX_BUILD_TYPE ${CMAKE_BUILD_TYPE}) set(MDBX_BUILD_TYPE ${CMAKE_BUILD_TYPE})
endif() endif()
# options # options
set(options VERSION C_COMPILER CXX_COMPILER) set(options VERSION C_COMPILER CXX_COMPILER MDBX_BUILD_TARGET MDBX_BUILD_TYPE)
foreach(item IN LISTS options) foreach(item IN LISTS options)
if(DEFINED ${item}) if(DEFINED ${item})
set(value "${${item}}") set(value "${${item}}")
@ -818,7 +819,7 @@ add_definitions(-DMDBX_CONFIG_H="${CMAKE_CURRENT_BINARY_DIR}/config.h")
################################################################################ ################################################################################
if(NOT MDBX_AMALGAMATED_SOURCE AND MDBX_ENABLE_TESTS) if(NOT MDBX_AMALGAMATED_SOURCE AND MDBX_ENABLE_TESTS)
if(NOT CMAKE_CXX_COMPILER) if(NOT CMAKE_CXX_COMPILER_LOADED)
message(FATAL_ERROR "MDBX_ENABLE_TESTS=${MDBX_ENABLE_TESTS}: The C++ compiler is required to build the tests.") message(FATAL_ERROR "MDBX_ENABLE_TESTS=${MDBX_ENABLE_TESTS}: The C++ compiler is required to build the tests.")
endif() endif()
add_subdirectory(test) add_subdirectory(test)

View File

@ -42,11 +42,21 @@
#endif #endif
/* Build Info */ /* Build Info */
#ifndef MDBX_BUILD_TIMESTAMP
#cmakedefine MDBX_BUILD_TIMESTAMP "@MDBX_BUILD_TIMESTAMP@" #cmakedefine MDBX_BUILD_TIMESTAMP "@MDBX_BUILD_TIMESTAMP@"
#endif
#ifndef MDBX_BUILD_TARGET
#cmakedefine MDBX_BUILD_TARGET "@MDBX_BUILD_TARGET@" #cmakedefine MDBX_BUILD_TARGET "@MDBX_BUILD_TARGET@"
#endif
#ifndef MDBX_BUILD_TYPE
#cmakedefine MDBX_BUILD_TYPE "@MDBX_BUILD_TYPE@" #cmakedefine MDBX_BUILD_TYPE "@MDBX_BUILD_TYPE@"
#endif
#ifndef MDBX_BUILD_COMPILER
#cmakedefine MDBX_BUILD_COMPILER "@MDBX_BUILD_COMPILER@" #cmakedefine MDBX_BUILD_COMPILER "@MDBX_BUILD_COMPILER@"
#endif
#ifndef MDBX_BUILD_FLAGS
#cmakedefine MDBX_BUILD_FLAGS "@MDBX_BUILD_FLAGS@" #cmakedefine MDBX_BUILD_FLAGS "@MDBX_BUILD_FLAGS@"
#endif
#cmakedefine MDBX_BUILD_SOURCERY @MDBX_BUILD_SOURCERY@ #cmakedefine MDBX_BUILD_SOURCERY @MDBX_BUILD_SOURCERY@
/* *INDENT-ON* */ /* *INDENT-ON* */