diff options
author | Pedro Costa <p.simoes.costa@gmail.com> | 2021-12-13 07:02:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 08:02:02 +0100 |
commit | d99ad594f731511413f5bad96f0c0dfe0c2c08aa (patch) | |
tree | bb2ae9a678d659c5ff00788acf65582794e7dfb8 /src/fpm_compiler.f90 | |
parent | cc8a92006cdb1be73457734f354a4abff5167555 (diff) | |
download | fpm-d99ad594f731511413f5bad96f0c0dfe0c2c08aa.tar.gz fpm-d99ad594f731511413f5bad96f0c0dfe0c2c08aa.zip |
Better extraction of the Fortran compiler from the MPI wrapper (#634)
- changed command to one supported by more (all?) MPI libraries
Diffstat (limited to 'src/fpm_compiler.f90')
-rw-r--r-- | src/fpm_compiler.f90 | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index c0c5b73..bccff74 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -40,7 +40,7 @@ use fpm_environment, only: & OS_UNKNOWN use fpm_filesystem, only: join_path, basename, get_temp_filename, delete_file, unix_path, & & getline -use fpm_strings, only: string_cat, string_t +use fpm_strings, only: split, string_cat, string_t implicit none public :: compiler_t, new_compiler, archiver_t, new_archiver public :: debug @@ -467,7 +467,7 @@ function get_compiler_id(compiler) result(id) character(len=*), intent(in) :: compiler integer(kind=compiler_enum) :: id - character(len=:), allocatable :: command, output + character(len=:), allocatable :: full_command, full_command_parts(:), command, output integer :: stat, io ! Check whether we are dealing with an MPI compiler wrapper first @@ -475,14 +475,18 @@ function get_compiler_id(compiler) result(id) & .or. check_compiler(compiler, "mpif90") & & .or. check_compiler(compiler, "mpif77")) then output = get_temp_filename() - call run(compiler//" -showme:command > "//output//" 2>&1", & + call run(compiler//" -show > "//output//" 2>&1", & & echo=.false., exitstat=stat) if (stat == 0) then open(file=output, newunit=io, iostat=stat) - if (stat == 0) call getline(io, command, stat) + if (stat == 0) call getline(io, full_command, stat) close(io, iostat=stat) ! If we get a command from the wrapper, we will try to identify it + call split(full_command, full_command_parts, delimiters=' ') + if(size(full_command_parts) > 0)then + command = trim(full_command_parts(1)) + endif if (allocated(command)) then id = get_id(command) if (id /= id_unknown) return |