Skip to content

Commit 6561164

Browse files
committed
[introspection] wrapper to check supported compiler flags
1 parent cf820b7 commit 6561164

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/fpm_compiler.F90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ module fpm_compiler
124124
procedure :: load_from_toml => compiler_load
125125
!> Fortran feature support
126126
procedure :: check_fortran_source_runs
127+
procedure :: check_flags_supported
127128
procedure :: with_xdp
128129
procedure :: with_qp
129130
!> Return compiler name
@@ -1496,6 +1497,18 @@ logical function check_fortran_source_runs(self, input, compile_flags, link_flag
14961497

14971498
end function check_fortran_source_runs
14981499

1500+
!> Check if the given compile and/or link flags are accepted by the compiler
1501+
logical function check_flags_supported(self, compile_flags, link_flags)
1502+
class(compiler_t), intent(in) :: self
1503+
character(len=*), optional, intent(in) :: compile_flags, link_flags
1504+
1505+
! Minimal program that always compiles
1506+
character(len=*), parameter :: hello_world = "print *, 'Hello, World!'; end"
1507+
1508+
check_flags_supported = self%check_fortran_source_runs(hello_world, compile_flags, link_flags)
1509+
1510+
end function check_flags_supported
1511+
14991512
!> Check if the current compiler supports 128-bit real precision
15001513
logical function with_qp(self)
15011514
!> Instance of the compiler object

0 commit comments

Comments
 (0)