mdbx-cmake: add linking with stdc++fs for LCC < 1.26

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-04-05 17:02:39 +03:00
parent 7b95720f59
commit f054ceeab8
3 changed files with 12 additions and 4 deletions

View File

@ -612,8 +612,8 @@ macro(libmdbx_setup_libs TARGET MODE)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(${TARGET} ${MODE} log) target_link_libraries(${TARGET} ${MODE} log)
endif() endif()
if(MDBX_CXX_STANDARD GREATER_EQUAL 17 AND LIBCXX_FILESYSTEM AND MDBX_BUILD_CXX) if(LIBCXX_FILESYSTEM AND MDBX_BUILD_CXX)
target_link_libraries(${TARGET} ${MODE} ${LIBCXX_FILESYSTEM}) target_link_libraries(${TARGET} PUBLIC ${LIBCXX_FILESYSTEM})
endif() endif()
endmacro() endmacro()

View File

@ -823,9 +823,13 @@ macro(setup_compile_flags)
endmacro(setup_compile_flags) endmacro(setup_compile_flags)
if(CMAKE_CXX_COMPILER_LOADED) if(CMAKE_CXX_COMPILER_LOADED)
# determine library for for std::filesystem # determine library for std::filesystem
set(LIBCXX_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) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
set(LIBCXX_FILESYSTEM "c++experimental") set(LIBCXX_FILESYSTEM "c++experimental")
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)

View File

@ -45,6 +45,10 @@ set_target_properties(mdbx_test PROPERTIES
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>) INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
target_setup_options(mdbx_test) 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}) target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
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)