aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2020-09-29 09:38:36 +0100
committerLKedward <laurence.kedward@bristol.ac.uk>2020-09-29 09:38:36 +0100
commitc058c12e0bba167f59a3270b80e7617b002d7b36 (patch)
tree52d2dbc5967f9e8a1e5bcdc3e9c0c2af75107a64
parenta82a07155261116fc15947d1fbf7d3eaa85af103 (diff)
downloadfpm-c058c12e0bba167f59a3270b80e7617b002d7b36.tar.gz
fpm-c058c12e0bba167f59a3270b80e7617b002d7b36.zip
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
-rw-r--r--fpm/src/fpm_sources.f906
1 files changed, 4 insertions, 2 deletions
diff --git a/fpm/src/fpm_sources.f90 b/fpm/src/fpm_sources.f90
index 266e52a..e8b2f88 100644
--- a/fpm/src/fpm_sources.f90
+++ b/fpm/src/fpm_sources.f90
@@ -6,7 +6,7 @@ use fpm_model, only: srcfile_ptr, srcfile_t, fpm_model_t, &
FPM_UNIT_CSOURCE, FPM_UNIT_CHEADER, FPM_SCOPE_UNKNOWN, &
FPM_SCOPE_LIB, FPM_SCOPE_DEP, FPM_SCOPE_APP, FPM_SCOPE_TEST
-use fpm_filesystem, only: basename, dirname, read_lines, list_files
+use fpm_filesystem, only: basename, canon_path, dirname, read_lines, list_files
use fpm_strings, only: lower, split, str_ends_with, string_t, operator(.in.)
use fpm_manifest_executable, only: executable_t
implicit none
@@ -137,7 +137,9 @@ subroutine add_executable_sources(sources,executables,scope,error)
do j=1,size(executables)
if (basename(sources(i)%file_name,suffix=.true.) == &
- executables(j)%main) then
+ if (basename(sources(i)%file_name,suffix=.true.) == executables(j)%main .and.&
+ canon_path(dirname(sources(i)%file_name)) == &
+ canon_path(executables(j)%source_dir) ) then
sources(i)%exe_name = executables(j)%name
exit