diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index f48579047..4978a3d78 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -92,7 +92,15 @@ else() target_link_libraries(algorithms_libs PRIVATE Boost::filesystem Boost::system) endif() -if(NOT (CMAKE_CXX_STANDARD VERSION_LESS 20)) +include(CheckCXXSourceCompiles) +check_cxx_source_compiles(" + #include + int main() + { std::span sv; }" + has_span +) + +if(${has_span}) target_compile_definitions(algorithms_libs PUBLIC -DHAS_SPAN=1) else() target_include_directories(algorithms_libs