diff --git a/CMakeLists.txt b/CMakeLists.txt index 919eb57f..9673c956 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -612,8 +612,8 @@ macro(libmdbx_setup_libs TARGET MODE) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android") target_link_libraries(${TARGET} ${MODE} log) endif() - if(MDBX_CXX_STANDARD GREATER_EQUAL 17 AND LIBCXX_FILESYSTEM AND MDBX_BUILD_CXX) - target_link_libraries(${TARGET} ${MODE} ${LIBCXX_FILESYSTEM}) + if(LIBCXX_FILESYSTEM AND MDBX_BUILD_CXX) + target_link_libraries(${TARGET} PUBLIC ${LIBCXX_FILESYSTEM}) endif() endmacro() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 8e310cbb..c00ded41 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -823,9 +823,13 @@ macro(setup_compile_flags) endmacro(setup_compile_flags) if(CMAKE_CXX_COMPILER_LOADED) - # determine library for for std::filesystem + # determine library for std::filesystem set(LIBCXX_FILESYSTEM "") - if(CMAKE_COMPILER_IS_CLANG) + if(CMAKE_COMPILER_IS_ELBRUSCXX) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.26.0) + set(LIBCXX_FILESYSTEM "stdc++fs") + endif() + elseif(CMAKE_COMPILER_IS_CLANG) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set(LIBCXX_FILESYSTEM "c++experimental") elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 82858066..fe397141 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -45,6 +45,10 @@ set_target_properties(mdbx_test PROPERTIES INTERPROCEDURAL_OPTIMIZATION $) target_setup_options(mdbx_test) +if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM) + target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM}) +endif() + target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT}) if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") target_link_libraries(mdbx_test winmm.lib)