add feature detection machinery

This commit is contained in:
Ferdinand Bachmann committed 2020-04-18 12:39:58 +02:00
1 parent ce9d000673
commit 5feb3f4f60
7 files changed
+315 -222

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
if(cxx_noexcept IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(RING_BUFFER_NOEXCEPT ON)
message(STATUS "Detected support for conditional noexcept")
endif()
if(cxx_constexpr IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(RING_BUFFER_CONSTEXPR ON)
message(STATUS "Detected support for constexpr")
endif()
try_compile(constexpr-destructors-compile ${CMAKE_BINARY_DIR}/detect ${CMAKE_SOURCE_DIR}/detect/constexpr_destructors.cpp
CXX_STANDARD ${CMAKE_CXX_STANDARD}
CXX_STANDARD_REQUIRED ${CMAKE_CXX_STANDARD_REQUIRED}
CXX_EXTENSIONS ${CMAKE_CXX_EXTENSIONS}
)
if(constexpr-destructors-compile)
set(RING_BUFFER_CONSTEXPR_DESTRUCTORS ON)
message(STATUS "Detected support for constexpr destructors")
endif()