aboutsummaryrefslogtreecommitdiff
path: root/src/fpm_compiler.f90
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2021-04-08 15:27:07 +0100
committerLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-04-09 14:45:28 +0100
commitc957b27d275ebd575b5d49599c14e7252765f3ce (patch)
tree5521db39bd1ea60963b26d012cffee030372a8a8 /src/fpm_compiler.f90
parentf28ac3e31cb0e5c558a4fdb4ce5f461ce1c83ea4 (diff)
downloadfpm-c957b27d275ebd575b5d49599c14e7252765f3ce.tar.gz
fpm-c957b27d275ebd575b5d49599c14e7252765f3ce.zip
Select c compiler based on fortran compiler id
Diffstat (limited to 'src/fpm_compiler.f90')
-rw-r--r--src/fpm_compiler.f9027
1 files changed, 27 insertions, 0 deletions
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90
index 36041bf..76aedcc 100644
--- a/src/fpm_compiler.f90
+++ b/src/fpm_compiler.f90
@@ -336,6 +336,33 @@ subroutine get_module_flags(compiler, modpath, flags)
end subroutine get_module_flags
+subroutine get_default_c_compiler(f_compiler, c_compiler)
+ character(len=*), intent(in) :: f_compiler
+ character(len=:), allocatable, intent(out) :: c_compiler
+ integer(compiler_enum) :: id
+
+ id = get_compiler_id(f_compiler)
+
+ select case(id)
+ case default
+ c_compiler = 'gcc'
+
+ case(id_intel_classic)
+ c_compiler = 'icc'
+
+ case(id_intel_llvm)
+ c_compiler = 'icx'
+
+ case(id_flang)
+ c_compiler='clang'
+
+ case(id_ibmxl)
+ c_compiler='xlc'
+
+ end select
+
+end subroutine get_default_c_compiler
+
function get_compiler_id(compiler) result(id)
character(len=*), intent(in) :: compiler
integer(kind=compiler_enum) :: id