Skip to content

Commit f48ad91

Browse files
committed
speedup feature checks
1 parent b3a9f32 commit f48ad91

11 files changed

+52
-36
lines changed

cmake/f08contig.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
13
# ifort-19 yes, Flang yes, NAG yes, gfortran-8 no, gfortran-9 yes
24
check_source_compiles(Fortran
35
"program test
4-
print*, is_contiguous([0,0])
6+
intrinsic :: is_contiguous
7+
print '(L1)', is_contiguous([0,0])
58
end program"
69
f08contig
710
)

cmake/f08execute.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
check_source_compiles(Fortran
2-
"program a
3-
implicit none
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
3+
check_source_compiles(Fortran "program test
4+
intrinsic :: execute_command_line
45
56
call execute_command_line('echo hello')
67

cmake/f08kind.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
check_source_compiles(Fortran
2-
"program test
3-
use, intrinsic:: iso_fortran_env, only: real128
4-
use, intrinsic:: ieee_arithmetic, only: ieee_is_nan
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
3+
check_source_compiles(Fortran "program test
4+
5+
use, intrinsic :: iso_fortran_env, only: real128
6+
use, intrinsic :: ieee_arithmetic, only: ieee_is_nan
57
68
real(real128) :: pi128 = 4*atan(1.0_real128)
79
810
print *, huge(0._real128)
9-
print *, ieee_is_nan(0._real128)
11+
print '(L1)', ieee_is_nan(0._real128)
1012
1113
end program"
1214
f08kind

cmake/f18abstract.cmake

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1-
file(READ ${PROJECT_SOURCE_DIR}/test/standard/abstract.f90 _code)
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
22

33
check_source_compiles(Fortran
4-
"${_code}"
4+
"module abstract_interface
5+
6+
abstract interface
7+
real function fun()
8+
end function fun
9+
end interface
10+
11+
contains
12+
13+
subroutine canary(f)
14+
procedure(fun), pointer, intent(in) :: f
15+
real :: a
16+
17+
a = f()
18+
end subroutine canary
19+
20+
end module abstract_interface"
521
f18abstract
622
)

cmake/f18prop.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
check_source_compiles(Fortran
2-
"program test
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
3+
check_source_compiles(Fortran "program test
34
complex :: z
4-
print *,z%re,z%im,z%kind
5+
print *, z%re, z%im, z%kind
56
end program"
67
f18prop
78
)

cmake/f18random.cmake

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
13
check_source_compiles(Fortran
24
"program test
5+
intrinsic :: random_init
36
call random_init(.false., .false.)
47
end program"
58
f18random
69
)
7-
8-
if(NOT f18random)
9-
return()
10-
endif()
11-
12-
file(READ ${PROJECT_SOURCE_DIR}/test/standard/random_init.f90 _s)
13-
14-
check_source_runs(Fortran ${_s} f18random_init)

cmake/f2023rank_integer.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
check_source_compiles(Fortran
2-
"program r
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
3+
check_source_compiles(Fortran "program test
34
real, rank(2) :: a
45
!! Equivalent to real :: a(:,:)
5-
end program
6-
"
6+
end program"
77
f2023rank_integer)

cmake/f2023real16.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
check_source_compiles(Fortran
2-
"program r16
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
32

3+
check_source_compiles(Fortran "program test
44
use, intrinsic :: iso_fortran_env, only: real16
5-
65
end program"
76
f2023real16
87
)

cmake/f2023ternary.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
check_source_compiles(Fortran
2-
"program tern
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2+
3+
check_source_compiles(Fortran "program test
34
45
real :: a, value
56

cmake/f2023tokenize.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
check_source_compiles(Fortran
2-
"
3-
program toke
1+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
42

3+
check_source_compiles(Fortran "program test
54
intrinsic :: tokenize
6-
75
end program"
86
f2023tokenize
97
)

0 commit comments

Comments
 (0)