mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:34:13 +08:00
mdbx-cmake: совместимость с CMake 3.0.2 для CI на старых системах.
This commit is contained in:
parent
79c65821ee
commit
623ab21707
@ -34,7 +34,9 @@
|
|||||||
## The Future will (be) Positive. Всё будет хорошо.
|
## The Future will (be) Positive. Всё будет хорошо.
|
||||||
##
|
##
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
if(CMAKE_VERSION VERSION_LESS 3.8.2)
|
||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
elseif(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
cmake_minimum_required(VERSION 3.8.2)
|
cmake_minimum_required(VERSION 3.8.2)
|
||||||
else()
|
else()
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
@ -385,6 +387,8 @@ if(NOT DEFINED MDBX_CXX_STANDARD)
|
|||||||
set(MDBX_CXX_STANDARD 14)
|
set(MDBX_CXX_STANDARD 14)
|
||||||
elseif(NOT HAS_CXX11 LESS 0)
|
elseif(NOT HAS_CXX11 LESS 0)
|
||||||
set(MDBX_CXX_STANDARD 11)
|
set(MDBX_CXX_STANDARD 11)
|
||||||
|
elseif(CXX_FALLBACK_GNU11 OR CXX_FALLBACK_11)
|
||||||
|
set(MDBX_CXX_STANDARD 11)
|
||||||
else()
|
else()
|
||||||
set(MDBX_CXX_STANDARD 98)
|
set(MDBX_CXX_STANDARD 98)
|
||||||
endif()
|
endif()
|
||||||
@ -533,7 +537,7 @@ else()
|
|||||||
unset(MDBX_LINK_TOOLS_NONSTATIC CACHE)
|
unset(MDBX_LINK_TOOLS_NONSTATIC CACHE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_LOADED AND MDBX_CXX_STANDARD GREATER_EQUAL 11 AND MDBX_CXX_STANDARD LESS 83)
|
if(CMAKE_CXX_COMPILER_LOADED AND MDBX_CXX_STANDARD LESS 83 AND NOT MDBX_CXX_STANDARD LESS 11)
|
||||||
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()
|
||||||
@ -639,7 +643,11 @@ macro(target_setup_options TARGET)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(libmdbx_setup_libs TARGET MODE)
|
macro(libmdbx_setup_libs TARGET MODE)
|
||||||
target_link_libraries(${TARGET} ${MODE} Threads::Threads)
|
if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||||
|
target_link_libraries(${TARGET} ${MODE} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
else()
|
||||||
|
target_link_libraries(${TARGET} ${MODE} Threads::Threads)
|
||||||
|
endif()
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
target_link_libraries(${TARGET} ${MODE} ntdll advapi32)
|
target_link_libraries(${TARGET} ${MODE} ntdll advapi32)
|
||||||
if(MDBX_NTDLL_EXTRA_IMPLIB AND MDBX_WITHOUT_MSVC_CRT)
|
if(MDBX_NTDLL_EXTRA_IMPLIB AND MDBX_WITHOUT_MSVC_CRT)
|
||||||
@ -906,16 +914,16 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
if(CMAKE_C_COMPILER_ABI
|
if(CMAKE_C_COMPILER_ABI
|
||||||
AND NOT (CMAKE_C_COMPILER_ABI MATCHES ".*${MDBX_BUILD_TARGET}.*" OR MDBX_BUILD_TARGET MATCHES ".*${CMAKE_C_COMPILER_ABI}.*"))
|
AND NOT (CMAKE_C_COMPILER_ABI MATCHES ".*${MDBX_BUILD_TARGET}.*" OR MDBX_BUILD_TARGET MATCHES ".*${CMAKE_C_COMPILER_ABI}.*"))
|
||||||
string(APPEND MDBX_BUILD_TARGET "-${CMAKE_C_COMPILER_ABI}")
|
string(CONCAT MDBX_BUILD_TARGET "${MDBX_BUILD_TARGET}-${CMAKE_C_COMPILER_ABI}")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_C_PLATFORM_ID
|
if(CMAKE_C_PLATFORM_ID
|
||||||
AND NOT (CMAKE_SYSTEM_NAME
|
AND NOT (CMAKE_SYSTEM_NAME
|
||||||
AND (CMAKE_C_PLATFORM_ID MATCHES ".*${CMAKE_SYSTEM_NAME}.*" OR CMAKE_SYSTEM_NAME MATCHES ".*${CMAKE_C_PLATFORM_ID}.*"))
|
AND (CMAKE_C_PLATFORM_ID MATCHES ".*${CMAKE_SYSTEM_NAME}.*" OR CMAKE_SYSTEM_NAME MATCHES ".*${CMAKE_C_PLATFORM_ID}.*"))
|
||||||
AND NOT (CMAKE_C_PLATFORM_ID MATCHES ".*${CMAKE_C_PLATFORM_ID}.*" OR MDBX_BUILD_TARGET MATCHES ".*${CMAKE_C_PLATFORM_ID}.*"))
|
AND NOT (CMAKE_C_PLATFORM_ID MATCHES ".*${CMAKE_C_PLATFORM_ID}.*" OR MDBX_BUILD_TARGET MATCHES ".*${CMAKE_C_PLATFORM_ID}.*"))
|
||||||
string(APPEND MDBX_BUILD_TARGET "-${CMAKE_C_COMPILER_ABI}")
|
string(CONCAT MDBX_BUILD_TARGET "${MDBX_BUILD_TARGET}-${CMAKE_C_COMPILER_ABI}")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME)
|
if(CMAKE_SYSTEM_NAME)
|
||||||
string(APPEND MDBX_BUILD_TARGET "-${CMAKE_SYSTEM_NAME}")
|
string(CONCAT MDBX_BUILD_TARGET "${MDBX_BUILD_TARGET}-${CMAKE_SYSTEM_NAME}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
## limitations under the License.
|
## limitations under the License.
|
||||||
##
|
##
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
if(CMAKE_VERSION VERSION_LESS 3.8.2)
|
||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
elseif(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
cmake_minimum_required(VERSION 3.8.2)
|
cmake_minimum_required(VERSION 3.8.2)
|
||||||
else()
|
else()
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
@ -958,12 +960,13 @@ endmacro(setup_compile_flags)
|
|||||||
macro(probe_libcxx_filesystem)
|
macro(probe_libcxx_filesystem)
|
||||||
if(CMAKE_CXX_COMPILER_LOADED AND NOT DEFINED LIBCXX_FILESYSTEM)
|
if(CMAKE_CXX_COMPILER_LOADED AND NOT DEFINED LIBCXX_FILESYSTEM)
|
||||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_11 HAS_CXX11)
|
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_11 HAS_CXX11)
|
||||||
if(NOT HAS_CXX11 LESS 0)
|
if(NOT HAS_CXX11 LESS 0 OR CXX_FALLBACK_GNU11 OR CXX_FALLBACK_11)
|
||||||
include(CMakePushCheckState)
|
include(CMakePushCheckState)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
set(stdfs_probe_save_libraries ${CMAKE_REQUIRED_LIBRARIES})
|
set(stdfs_probe_save_libraries ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
set(stdfs_probe_save_flags ${CMAKE_REQUIRED_FLAGS})
|
set(stdfs_probe_save_flags ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(stdfs_probe_flags ${CMAKE_REQUIRED_FLAGS})
|
||||||
set(stdfs_probe_save_link_options ${CMAKE_REQUIRED_LINK_OPTIONS})
|
set(stdfs_probe_save_link_options ${CMAKE_REQUIRED_LINK_OPTIONS})
|
||||||
unset(stdfs_probe_clear_cxx_standard)
|
unset(stdfs_probe_clear_cxx_standard)
|
||||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||||
@ -974,18 +977,23 @@ macro(probe_libcxx_filesystem)
|
|||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
elseif(NOT HAS_CXX14 LESS 0)
|
elseif(NOT HAS_CXX14 LESS 0)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
else()
|
elseif(NOT HAS_CXX11 LESS 0)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
elseif(CXX_FALLBACK_GNU11)
|
||||||
|
set(stdfs_probe_flags ${stdfs_probe_flags} "-std=gnu++11")
|
||||||
|
else()
|
||||||
|
set(stdfs_probe_flags ${stdfs_probe_flags} "-std=c++11")
|
||||||
endif()
|
endif()
|
||||||
set(stdfs_probe_clear_cxx_standard ON)
|
set(stdfs_probe_clear_cxx_standard ON)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23)
|
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.14)
|
if(CMAKE_VERSION VERSION_LESS 3.14)
|
||||||
set(CMAKE_REQUIRED_FLAGS ${stdfs_probe_save_flags} "-Wl,--allow-multiple-definition")
|
set(stdfs_probe_flags ${stdfs_probe_flags} "-Wl,--allow-multiple-definition")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_REQUIRED_LINK_OPTIONS ${stdfs_probe_save_link_options} "-Wl,--allow-multiple-definition")
|
set(CMAKE_REQUIRED_LINK_OPTIONS ${stdfs_probe_save_link_options} "-Wl,--allow-multiple-definition")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${stdfs_probe_flags})
|
||||||
|
|
||||||
set(stdfs_probe_code [[
|
set(stdfs_probe_code [[
|
||||||
#if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && defined(__clang__) && __clang_major__ < 4
|
#if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && defined(__clang__) && __clang_major__ < 4
|
||||||
@ -1066,6 +1074,7 @@ macro(probe_libcxx_filesystem)
|
|||||||
unset(stdfs_probe_clear_cxx_standard)
|
unset(stdfs_probe_clear_cxx_standard)
|
||||||
unset(stdfs_probe_save_link_options)
|
unset(stdfs_probe_save_link_options)
|
||||||
unset(stdfs_probe_save_flags)
|
unset(stdfs_probe_save_flags)
|
||||||
|
unset(stdfs_probe_flags)
|
||||||
unset(stdfs_probe_save_libraries)
|
unset(stdfs_probe_save_libraries)
|
||||||
unset(stdfs_probe_code)
|
unset(stdfs_probe_code)
|
||||||
unset(stdfs_probe_rc)
|
unset(stdfs_probe_rc)
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
## limitations under the License.
|
## limitations under the License.
|
||||||
##
|
##
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
if(CMAKE_VERSION VERSION_LESS 3.8.2)
|
||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
elseif(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
cmake_minimum_required(VERSION 3.8.2)
|
cmake_minimum_required(VERSION 3.8.2)
|
||||||
else()
|
else()
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
## limitations under the License.
|
## limitations under the License.
|
||||||
##
|
##
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
if(CMAKE_VERSION VERSION_LESS 3.8.2)
|
||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
elseif(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
cmake_minimum_required(VERSION 3.8.2)
|
cmake_minimum_required(VERSION 3.8.2)
|
||||||
else()
|
else()
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
@ -54,7 +54,11 @@ if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM)
|
|||||||
target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM})
|
target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
|
if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||||
|
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
else()
|
||||||
|
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} Threads::Threads)
|
||||||
|
endif()
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
target_link_libraries(mdbx_test winmm.lib)
|
target_link_libraries(mdbx_test winmm.lib)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user