aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Une <brocolis@eml.cc>2021-10-16 12:54:19 -0300
committerGitHub <noreply@github.com>2021-10-16 17:54:19 +0200
commitd314aed051dbc83f1a5ce8dce39b3b70f552509d (patch)
tree04c24a1b74fe9a504dd590a476b9d76963237493 /src
parentdf9b01a652a37b968e29d32c24f3c690f130e890 (diff)
downloadfpm-d314aed051dbc83f1a5ce8dce39b3b70f552509d.tar.gz
fpm-d314aed051dbc83f1a5ce8dce39b3b70f552509d.zip
Change link command on Windows with `ifort` or `ifx` (#590)
* Check whether compiler is `ifort` or `ifx` on Windows * Linker command with ifort/ifx on Windows * Enumerate libraries, based on compiler and platform
Diffstat (limited to 'src')
-rw-r--r--src/fpm_compiler.f9019
-rw-r--r--src/fpm_targets.f908
2 files changed, 22 insertions, 5 deletions
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90
index 4b9fb85..e3c4719 100644
--- a/src/fpm_compiler.f90
+++ b/src/fpm_compiler.f90
@@ -94,6 +94,8 @@ contains
procedure :: link
!> Check whether compiler is recognized
procedure :: is_unknown
+ !> Enumerate libraries, based on compiler and platform
+ procedure :: enumerate_libraries
end type compiler_t
@@ -593,6 +595,23 @@ pure function is_unknown(self)
is_unknown = self%id == id_unknown
end function is_unknown
+!>
+!> Enumerate libraries, based on compiler and platform
+!>
+function enumerate_libraries(self, prefix, libs) result(r)
+ class(compiler_t), intent(in) :: self
+ character(len=*), intent(in) :: prefix
+ type(string_t), intent(in) :: libs(:)
+ character(len=:), allocatable :: r
+
+ if (self%id == id_intel_classic_windows .or. &
+ self%id == id_intel_llvm_windows) then
+ r = prefix // " " // string_cat(libs,".lib ")//".lib"
+ else
+ r = prefix // " -l" // string_cat(libs," -l")
+ end if
+end function enumerate_libraries
+
!> Create new compiler instance
subroutine new_compiler(self, fc, cc)
diff --git a/src/fpm_targets.f90 b/src/fpm_targets.f90
index 87809e6..e8fcf9c 100644
--- a/src/fpm_targets.f90
+++ b/src/fpm_targets.f90
@@ -466,7 +466,7 @@ subroutine resolve_target_linking(targets, model)
global_link_flags = ""
if (allocated(model%link_libraries)) then
if (size(model%link_libraries) > 0) then
- global_link_flags = global_link_flags // " -l" // string_cat(model%link_libraries," -l")
+ global_link_flags = model%compiler%enumerate_libraries(global_link_flags, model%link_libraries)
end if
end if
@@ -518,10 +518,8 @@ subroutine resolve_target_linking(targets, model)
if (allocated(target%link_libraries)) then
if (size(target%link_libraries) > 0) then
- target%link_flags = target%link_flags &
- & // " -l" // string_cat(target%link_libraries," -l")
- local_link_flags = local_link_flags &
- & // " -l" // string_cat(target%link_libraries," -l")
+ target%link_flags = model%compiler%enumerate_libraries(target%link_flags, target%link_libraries)
+ local_link_flags = model%compiler%enumerate_libraries(local_link_flags, target%link_libraries)
end if
end if