aboutsummaryrefslogtreecommitdiff
path: root/src/fpm.f90
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2021-04-22 09:20:50 -0500
committerGitHub <noreply@github.com>2021-04-22 09:20:50 -0500
commita1dbbdab1b1c1d3807d9aa970b7943792f33641f (patch)
treeee26e1ff4ccd05ed465463f82b6b3d37ba03e015 /src/fpm.f90
parentfaced2359ff7bf1c003aaf3990d006fde1124186 (diff)
parentfbbfb2c1c316674a83acd666754a3fd18b643d84 (diff)
downloadfpm-a1dbbdab1b1c1d3807d9aa970b7943792f33641f.tar.gz
fpm-a1dbbdab1b1c1d3807d9aa970b7943792f33641f.zip
Merge branch 'master' into different-archiver-on-windows
Diffstat (limited to 'src/fpm.f90')
-rw-r--r--src/fpm.f9012
1 files changed, 10 insertions, 2 deletions
diff --git a/src/fpm.f90 b/src/fpm.f90
index fa2087d..5854cfb 100644
--- a/src/fpm.f90
+++ b/src/fpm.f90
@@ -4,12 +4,12 @@ use fpm_backend, only: build_package
use fpm_command_line, only: fpm_build_settings, fpm_new_settings, &
fpm_run_settings, fpm_install_settings, fpm_test_settings
use fpm_dependency, only : new_dependency_tree
-use fpm_environment, only: get_archiver, run
+use fpm_environment, only: run, get_env, get_archiver
use fpm_filesystem, only: is_dir, join_path, number_of_rows, list_files, exists, basename
use fpm_model, only: fpm_model_t, srcfile_t, show_model, &
FPM_SCOPE_UNKNOWN, FPM_SCOPE_LIB, FPM_SCOPE_DEP, &
FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE, FPM_SCOPE_TEST
-use fpm_compiler, only: get_module_flags, is_unknown_compiler
+use fpm_compiler, only: get_module_flags, is_unknown_compiler, get_default_c_compiler
use fpm_sources, only: add_executable_sources, add_sources_from_dir
@@ -51,6 +51,7 @@ subroutine build_model(model, settings, package, error)
allocate(model%include_dirs(0))
allocate(model%link_libraries(0))
+ allocate(model%external_modules(0))
call new_dependency_tree(model%deps, cache=join_path("build", "cache.toml"))
call model%deps%add(package, error)
@@ -63,6 +64,8 @@ subroutine build_model(model, settings, package, error)
endif
model%archiver = get_archiver()
+ call get_default_c_compiler(model%fortran_compiler, model%c_compiler)
+ model%c_compiler = get_env('FPM_C_COMPILER',model%c_compiler)
if (is_unknown_compiler(model%fortran_compiler)) then
write(*, '(*(a:,1x))') &
@@ -173,6 +176,10 @@ subroutine build_model(model, settings, package, error)
if (allocated(dependency%build%link)) then
model%link_libraries = [model%link_libraries, dependency%build%link]
end if
+
+ if (allocated(dependency%build%external_modules)) then
+ model%external_modules = [model%external_modules, dependency%build%external_modules]
+ end if
end associate
end do
if (allocated(error)) return
@@ -180,6 +187,7 @@ subroutine build_model(model, settings, package, error)
if (settings%verbose) then
write(*,*)'<INFO> BUILD_NAME: ',settings%build_name
write(*,*)'<INFO> COMPILER: ',settings%compiler
+ write(*,*)'<INFO> C COMPILER: ',model%c_compiler
write(*,*)'<INFO> COMPILER OPTIONS: ', model%fortran_compile_flags
write(*,*)'<INFO> INCLUDE DIRECTORIES: [', string_cat(model%include_dirs,','),']'
end if