Silence MSVC atomic std::shared_ptr warning

Unfortunately std::atomic<std::shared_ptr> (P0718R2) is not supported by
GCC until GCC 12 and still is not supported by Clang or Apple Clang, so
it looks like we will continue using std::atomic_load for the time being
This commit is contained in:
Dalton Messmer
2024-10-21 21:40:06 -04:00
parent 027042a568
commit c5dc3fe43c

View File

@@ -44,6 +44,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
"-Werror" # Treat warnings as errors
)
endif()
set(SILENCE_DEPRECATION_DEFS "")
set(THIRD_PARTY_SILENCE_DEPRECATION_DEFS "")
elseif(MSVC)
set(COMPILE_ERROR_FLAGS
"/W2" # Enable some warnings by default
@@ -65,8 +68,12 @@ elseif(MSVC)
"/WX" # Treat warnings as errors
)
endif()
set(SILENCE_DEPRECATION_DEFS "_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING")
set(THIRD_PARTY_SILENCE_DEPRECATION_DEFS "")
endif()
# Add the flags to the whole directory tree. We use the third-party flags for
# targets whose SYSTEM property is true, and the normal flags otherwise.
add_compile_options("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_COMPILE_ERROR_FLAGS},${COMPILE_ERROR_FLAGS}>")
add_compile_definitions("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_SILENCE_DEPRECATION_DEFS},${SILENCE_DEPRECATION_DEFS}>")