Skip to content

Commit 0ab23f3

Browse files
committed
not all compilers have <span>
1 parent 59e8003 commit 0ab23f3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cmake/compilers.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include(CheckIncludeFile)
22
include(CheckSymbolExists)
3+
include(CheckIncludeFileCXX)
34

45
# --- abi check: C++ and Fortran compiler ABI compatibility
56

test/iso_fortran_binding/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ if(HAVE_C_ALLOC_CHAR)
1010
add_test(NAME string_view COMMAND string_view)
1111
endif()
1212

13+
check_include_file_cxx(span HAVE_SPAN)
1314

14-
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 12)
15+
if(NOT HAVE_SPAN OR
16+
(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
17+
CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 12))
1518
set(sampling_old TRUE)
1619
endif()
1720

1821
if(NOT sampling_old)
1922
add_executable(sampling sampling.cpp sampling.f90)
2023
set_property(TARGET sampling PROPERTY LINKER_LANGUAGE CXX)
24+
target_compile_features(sampling PRIVATE cxx_std_20)
25+
2126
add_test(NAME sampling COMMAND sampling)
2227
endif()
2328

0 commit comments

Comments
 (0)