mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-28 18:38:48 +08:00
mdbx-cmake: включение стандарта C23
.
This commit is contained in:
parent
d40e4db13a
commit
d2b74e4da5
@ -450,7 +450,6 @@ if(MDBX_MANAGE_BUILD_FLAGS)
|
||||
setup_compile_flags()
|
||||
endif()
|
||||
|
||||
list(FIND CMAKE_C_COMPILE_FEATURES c_std_11 HAS_C11)
|
||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_11 HAS_CXX11)
|
||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_14 HAS_CXX14)
|
||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_17 HAS_CXX17)
|
||||
@ -481,6 +480,9 @@ if(NOT DEFINED MDBX_CXX_STANDARD)
|
||||
set(MDBX_CXX_STANDARD 98)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(FIND CMAKE_C_COMPILE_FEATURES c_std_11 HAS_C11)
|
||||
list(FIND CMAKE_C_COMPILE_FEATURES c_std_23 HAS_C23)
|
||||
if(NOT DEFINED MDBX_C_STANDARD)
|
||||
# MSVC >= 19.28 (Microsoft Visual Studio 16.8) is mad!
|
||||
# It unable process Windows SDK headers in the C11 mode!
|
||||
@ -488,6 +490,8 @@ if(NOT DEFINED MDBX_C_STANDARD)
|
||||
set(MDBX_C_STANDARD 99)
|
||||
set(C_FALLBACK_11 OFF)
|
||||
set(C_FALLBACK_GNU11 OFF)
|
||||
elseif(NOT HAS_C23 LESS 0)
|
||||
set(MDBX_C_STANDARD 23)
|
||||
elseif(HAS_C11 LESS 0 AND NOT C_FALLBACK_GNU11 AND NOT C_FALLBACK_11)
|
||||
set(MDBX_C_STANDARD 99)
|
||||
else()
|
||||
@ -800,7 +804,7 @@ macro(target_setup_options TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
||||
endif()
|
||||
if(NOT C_FALLBACK_GNU11 AND NOT C_FALLBACK_11)
|
||||
if(NOT MDBX_C_STANDARD EQUAL 11 OR (NOT C_FALLBACK_GNU11 AND NOT C_FALLBACK_11))
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
@ -384,9 +384,13 @@ endif()
|
||||
if(CMAKE_CXX_COMPILER_LOADED)
|
||||
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_11 HAS_CXX11)
|
||||
if(HAS_CXX11 LESS 0)
|
||||
check_cxx_compiler_flag("-std=gnu++11" CXX_FALLBACK_GNU11)
|
||||
if(NOT CXX_FALLBACK_GNU11)
|
||||
check_cxx_compiler_flag("-std=c++11" CXX_FALLBACK_11)
|
||||
if (MSVC)
|
||||
check_cxx_compiler_flag("/std:c++11" CXX_FALLBACK_11)
|
||||
else()
|
||||
check_cxx_compiler_flag("-std=gnu++11" CXX_FALLBACK_GNU11)
|
||||
if(NOT CXX_FALLBACK_GNU11)
|
||||
check_cxx_compiler_flag("-std=c++11" CXX_FALLBACK_11)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user