diff --git a/CMakeLists.txt b/CMakeLists.txt index 56a893924..2ddc192be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -621,7 +621,7 @@ macro(libmdbx_setup_libs TARGET MODE) target_link_libraries(${TARGET} ${MODE} log) endif() if(LIBCXX_FILESYSTEM AND MDBX_BUILD_CXX) - if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.26.0 + if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23 AND NOT CMAKE_VERSION VERSION_LESS 3.13) target_link_options(${TARGET} PUBLIC "-Wl,--allow-multiple-definition") endif() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index c893867dc..17c468b73 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -913,6 +913,8 @@ macro(probe_libcxx_filesystem) include(CheckCXXSourceCompiles) cmake_push_check_state() set(stdfs_probe_save_libraries ${CMAKE_REQUIRED_LIBRARIES}) + set(stdfs_probe_save_flags ${CMAKE_REQUIRED_FLAGS}) + set(stdfs_probe_save_link_options ${CMAKE_REQUIRED_LINK_OPTIONS}) unset(stdfs_probe_clear_cxx_standard) if(NOT DEFINED CMAKE_CXX_STANDARD) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_14 HAS_CXX14) @@ -927,6 +929,13 @@ macro(probe_libcxx_filesystem) endif() set(stdfs_probe_clear_cxx_standard ON) endif() + if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23) + if(CMAKE_VERSION VERSION_LESS 3.14) + set(CMAKE_REQUIRED_FLAGS ${stdfs_probe_save_flags} "-Wl,--allow-multiple-definition") + else() + set(CMAKE_REQUIRED_LINK_OPTIONS ${stdfs_probe_save_link_options} "-Wl,--allow-multiple-definition") + endif() + endif() set(stdfs_probe_code [[ #if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && defined(__clang__) && __clang_major__ < 4 @@ -994,11 +1003,15 @@ macro(probe_libcxx_filesystem) endif() endif() + set(CMAKE_REQUIRED_LINK_OPTIONS ${stdfs_probe_save_link_options}) + set(CMAKE_REQUIRED_FLAGS ${stdfs_probe_save_flags}) set(CMAKE_REQUIRED_LIBRARIES ${stdfs_probe_save_libraries}) if(stdfs_probe_clear_cxx_standard) unset(CMAKE_CXX_STANDARD) endif() unset(stdfs_probe_clear_cxx_standard) + unset(stdfs_probe_save_link_options) + unset(stdfs_probe_save_flags) unset(stdfs_probe_save_libraries) unset(stdfs_probe_code) unset(stdfs_probe_rc) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d3f3b38e6..5e7066e16 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -47,7 +47,7 @@ set_target_properties(mdbx_test PROPERTIES target_setup_options(mdbx_test) if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM) - if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.26.0 + if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23 AND NOT CMAKE_VERSION VERSION_LESS 3.13) target_link_options(mdbx_test PRIVATE "-Wl,--allow-multiple-definition") endif()