Skip to content

Commit

Permalink
Fix autodiscovery for case-insensitive filesystems (#1007)
Browse files Browse the repository at this point in the history
Fix autodiscovery for case-insensitive filesystems
  • Loading branch information
perazz authored Mar 18, 2024
2 parents ad16060 + 912c85a commit b19c29a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/fpm_sources.f90
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ subroutine add_executable_sources(sources,executables,scope,auto_discover,with_f
! and apply any overrides
do j=1,size(sources)

if (basename(sources(j)%file_name,suffix=.true.) == executables(i)%main .and.&
!> Compare lowercase strings to allow auto-discovery of pre-processed extensions
if (lower(basename(sources(j)%file_name,suffix=.true.)) == lower(executables(i)%main) .and.&
canon_path(dirname(sources(j)%file_name)) == &
canon_path(executables(i)%source_dir) ) then

Expand Down
19 changes: 18 additions & 1 deletion src/fpm_targets.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ module fpm_targets

public FPM_TARGET_UNKNOWN, FPM_TARGET_EXECUTABLE, &
FPM_TARGET_ARCHIVE, FPM_TARGET_OBJECT, &
FPM_TARGET_C_OBJECT, FPM_TARGET_CPP_OBJECT
FPM_TARGET_C_OBJECT, FPM_TARGET_CPP_OBJECT, &
FPM_TARGET_NAME
public build_target_t, build_target_ptr
public targets_from_sources, resolve_module_dependencies
public add_target, add_dependency
Expand Down Expand Up @@ -137,6 +138,22 @@ module fpm_targets

contains

!> Target type name
pure function FPM_TARGET_NAME(type) result(msg)
integer, intent(in) :: type
character(:), allocatable :: msg

select case (type)
case (FPM_TARGET_ARCHIVE); msg = 'Archive'
case (FPM_TARGET_CPP_OBJECT); msg = 'C++ object'
case (FPM_TARGET_C_OBJECT); msg = 'C Object'
case (FPM_TARGET_EXECUTABLE); msg = 'Executable'
case (FPM_TARGET_OBJECT); msg = 'Object'
case default; msg = 'Unknown'
end select

end function FPM_TARGET_NAME

!> High-level wrapper to generate build target information
subroutine targets_from_sources(targets,model,prune,error)

Expand Down

0 comments on commit b19c29a

Please sign in to comment.