Skip to content

Commit dcca0fe

Browse files
committed
metapackage fix: clean before reading manifest, not after; refactor intel fix
1 parent e83c1c6 commit dcca0fe

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

src/fpm.f90

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -317,20 +317,27 @@ subroutine new_compiler_flags(model,settings)
317317
type(fpm_build_settings), intent(in) :: settings
318318

319319
character(len=:), allocatable :: flags, cflags, cxxflags, ldflags
320-
321-
if (len(settings%flag)>0) then
322-
320+
logical :: release_profile
321+
322+
if (allocated(settings%profile)) then
323+
release_profile = settings%profile == "release"
324+
else
325+
release_profile = .false.
326+
end if
327+
328+
if (.not.allocated(settings%flag)) then
329+
flags = model%compiler%get_default_flags(release_profile)
330+
elseif (settings%flag == '') then
331+
flags = model%compiler%get_default_flags(release_profile)
332+
else
323333
flags = settings%flag
324-
325-
elseif (allocated(settings%profile)) then
326-
327-
select case(settings%profile)
328-
case("release")
329-
flags = model%compiler%get_default_flags(release = .true.)
330-
case ("debug")
331-
flags = model%compiler%get_default_flags(release = .false.)
332-
end select
333-
end if
334+
if (allocated(settings%profile)) then
335+
select case(settings%profile)
336+
case("release", "debug")
337+
flags = flags // model%compiler%get_default_flags(release_profile)
338+
end select
339+
endif
340+
end if
334341

335342
cflags = trim(settings%cflag)
336343
cxxflags = trim(settings%cxxflag)

src/fpm/manifest/package.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ subroutine new_package(self, table, root, error)
133133
type(toml_array), pointer :: children
134134
character(len=:), allocatable :: version, version_file
135135
integer :: ii, nn, stat, io
136+
137+
! Ensure metapackage data is initialized although off
138+
call self%meta%reset()
136139

137140
call check(table, error)
138141
if (allocated(error)) return
@@ -219,9 +222,6 @@ subroutine new_package(self, table, root, error)
219222
call validate_profiles(self, error)
220223
if (allocated(error)) return
221224

222-
! Ensure metapackage data is initialized although off
223-
call self%meta%reset()
224-
225225
end subroutine new_package
226226

227227

0 commit comments

Comments
 (0)