Skip to content

Commit c058c12

Browse files
committed
Fix: matching of program sources with fpm executables
Add test on path of program source with source-dir of [[executable]] entry. For case of two executables with same name in different directories, both with overrides in fpm.toml
1 parent a82a071 commit c058c12

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fpm/src/fpm_sources.f90

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module fpm_sources
66
FPM_UNIT_CSOURCE, FPM_UNIT_CHEADER, FPM_SCOPE_UNKNOWN, &
77
FPM_SCOPE_LIB, FPM_SCOPE_DEP, FPM_SCOPE_APP, FPM_SCOPE_TEST
88

9-
use fpm_filesystem, only: basename, dirname, read_lines, list_files
9+
use fpm_filesystem, only: basename, canon_path, dirname, read_lines, list_files
1010
use fpm_strings, only: lower, split, str_ends_with, string_t, operator(.in.)
1111
use fpm_manifest_executable, only: executable_t
1212
implicit none
@@ -137,7 +137,9 @@ subroutine add_executable_sources(sources,executables,scope,error)
137137

138138
do j=1,size(executables)
139139
if (basename(sources(i)%file_name,suffix=.true.) == &
140-
executables(j)%main) then
140+
if (basename(sources(i)%file_name,suffix=.true.) == executables(j)%main .and.&
141+
canon_path(dirname(sources(i)%file_name)) == &
142+
canon_path(executables(j)%source_dir) ) then
141143

142144
sources(i)%exe_name = executables(j)%name
143145
exit

0 commit comments

Comments
 (0)