mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-20 07:49:27 +08:00
mdbx: more/refine C++ crutches for mad MSVC compiler.
This commit is contained in:
@@ -539,6 +539,13 @@ else()
|
||||
message(STATUS "Use C${MDBX_C_STANDARD} for libmdbx but C++ portion is disabled")
|
||||
endif()
|
||||
|
||||
if(SUBPROJECT AND MSVC)
|
||||
if(MSVC_VERSION LESS 1900)
|
||||
message(FATAL_ERROR "At least \"Microsoft C/C++ Compiler\" version 19.0.24234.1 (Visual Studio 2015 Update 3) is required.")
|
||||
endif()
|
||||
add_compile_options("/utf-8")
|
||||
endif()
|
||||
|
||||
macro(target_setup_options TARGET)
|
||||
if(DEFINED INTERPROCEDURAL_OPTIMIZATION)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
@@ -549,6 +556,9 @@ macro(target_setup_options TARGET)
|
||||
if(MDBX_BUILD_CXX)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
||||
if(MSVC AND NOT MSVC_VERSION LESS 1910)
|
||||
target_compile_options(${TARGET} INTERFACE "/Zc:__cplusplus")
|
||||
endif()
|
||||
endif()
|
||||
if(CC_HAS_FASTMATH)
|
||||
target_compile_options(${TARGET} PRIVATE "-ffast-math")
|
||||
@@ -557,7 +567,7 @@ macro(target_setup_options TARGET)
|
||||
target_compile_options(${TARGET} PRIVATE "-fvisibility=hidden")
|
||||
endif()
|
||||
if(BUILD_FOR_NATIVE_CPU AND CC_HAS_ARCH_NATIVE)
|
||||
target_compile_options(${TARGET} PUBLIC "-march=native")
|
||||
target_compile_options(${TARGET} PRIVATE "-march=native")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
Reference in New Issue
Block a user