diff --git a/CMakeLists.txt b/CMakeLists.txt index 59dcada5..c2ce48e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -804,13 +804,15 @@ macro(target_setup_options TARGET) set_target_properties(${TARGET} PROPERTIES INTERPROCEDURAL_OPTIMIZATION $) endif() - if(NOT MDBX_C_STANDARD EQUAL 11 OR (NOT C_FALLBACK_GNU11 AND NOT C_FALLBACK_11)) + if(NOT C_FALLBACK_GNU11 AND NOT C_FALLBACK_11) set_target_properties(${TARGET} PROPERTIES C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON) endif() if(MDBX_BUILD_CXX) - set_target_properties(${TARGET} PROPERTIES - CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON) + if(NOT CXX_FALLBACK_GNU11 AND NOT CXX_FALLBACK_11) + set_target_properties(${TARGET} PROPERTIES + CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON) + endif() if(MSVC AND NOT MSVC_VERSION LESS 1910) target_compile_options(${TARGET} INTERFACE "/Zc:__cplusplus") endif() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index e05df1a6..f9c23c20 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -386,7 +386,7 @@ endif() if(CMAKE_CXX_COMPILER_LOADED) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_11 HAS_CXX11) if(HAS_CXX11 LESS 0) - if (MSVC) + if(MSVC) check_cxx_compiler_flag("/std:c++11" CXX_FALLBACK_11) else() check_cxx_compiler_flag("-std=gnu++11" CXX_FALLBACK_GNU11) @@ -401,7 +401,7 @@ endif() if(CMAKE_C_COMPILER_LOADED) list(FIND CMAKE_C_COMPILE_FEATURES c_std_11 HAS_C11) if(HAS_C11 LESS 0) - if (MSVC) + if(MSVC) check_c_compiler_flag("/std:c11" C_FALLBACK_11) else() check_c_compiler_flag("-std=gnu11" C_FALLBACK_GNU11)