mirror of
https://github.com/Ferdi265/cxx-ring-buffer.git
synced 2025-07-29 15:17:15 +02:00
CMake: detect/features.cmake: fix try_compile if CXX_STANDARD or CXX_EXTENSIONS unset
This commit is contained in:
@ -1,8 +1,5 @@
|
|||||||
try_compile(cxx-least-11 ${CMAKE_BINARY_DIR}/detect ${CMAKE_SOURCE_DIR}/detect/cxxstd.cpp
|
try_compile(cxx-least-11 ${CMAKE_BINARY_DIR}/detect ${CMAKE_SOURCE_DIR}/detect/cxxstd.cpp
|
||||||
COMPILE_DEFINITIONS -DCXX_STANDARD=201103
|
COMPILE_DEFINITIONS -DCXX_STANDARD=201103
|
||||||
CXX_STANDARD ${CMAKE_CXX_STANDARD}
|
|
||||||
CXX_STANDARD_REQUIRED ${CMAKE_CXX_STANDARD_REQUIRED}
|
|
||||||
CXX_EXTENSIONS ${CMAKE_CXX_EXTENSIONS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT cxx-least-11)
|
if(NOT cxx-least-11)
|
||||||
@ -16,20 +13,13 @@ endif()
|
|||||||
|
|
||||||
try_compile(cxx-least-14 ${CMAKE_BINARY_DIR}/detect ${CMAKE_SOURCE_DIR}/detect/cxxstd.cpp
|
try_compile(cxx-least-14 ${CMAKE_BINARY_DIR}/detect ${CMAKE_SOURCE_DIR}/detect/cxxstd.cpp
|
||||||
COMPILE_DEFINITIONS -DCXX_STANDARD=201402
|
COMPILE_DEFINITIONS -DCXX_STANDARD=201402
|
||||||
CXX_STANDARD ${CMAKE_CXX_STANDARD}
|
|
||||||
CXX_STANDARD_REQUIRED ${CMAKE_CXX_STANDARD_REQUIRED}
|
|
||||||
CXX_EXTENSIONS ${CMAKE_CXX_EXTENSIONS}
|
|
||||||
)
|
)
|
||||||
if(cxx-least-14)
|
if(cxx-least-14)
|
||||||
set(RING_BUFFER_CONSTEXPR ON)
|
set(RING_BUFFER_CONSTEXPR ON)
|
||||||
message(STATUS "Enabling RING_BUFFER_CONSTEXPR (C++14 and up)")
|
message(STATUS "Enabling RING_BUFFER_CONSTEXPR (C++14 and up)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
try_compile(constexpr-destructors-compile ${CMAKE_BINARY_DIR}/detect ${CMAKE_SOURCE_DIR}/detect/constexpr_destructors.cpp
|
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)
|
if(constexpr-destructors-compile)
|
||||||
set(RING_BUFFER_CONSTEXPR_DESTRUCTORS ON)
|
set(RING_BUFFER_CONSTEXPR_DESTRUCTORS ON)
|
||||||
message(STATUS "Enabling RING_BUFFER_CONSTEXPR_DESTRUCTORS (C++20 and up)")
|
message(STATUS "Enabling RING_BUFFER_CONSTEXPR_DESTRUCTORS (C++20 and up)")
|
||||||
|
Reference in New Issue
Block a user