diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-03-20 10:43:39 +0100 |
---|---|---|
committer | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-03-20 10:48:10 +0100 |
commit | ecb731121f888765cd604f15333b9cc059dd9e0a (patch) | |
tree | 02bf337ff5f46432b8cd87356a0b26781e47d0ac | |
parent | 6e1ce8de0803e513ed602a841e3f1f12801d2dcb (diff) | |
download | fpm-ecb731121f888765cd604f15333b9cc059dd9e0a.tar.gz fpm-ecb731121f888765cd604f15333b9cc059dd9e0a.zip |
Warn if the compiler is not correctly identified
-rw-r--r-- | fpm/src/fpm.f90 | 7 | ||||
-rw-r--r-- | fpm/src/fpm_command_line.f90 | 8 | ||||
-rw-r--r-- | fpm/src/fpm_compiler.f90 | 7 |
3 files changed, 17 insertions, 5 deletions
diff --git a/fpm/src/fpm.f90 b/fpm/src/fpm.f90 index c66abf2..d0acaf5 100644 --- a/fpm/src/fpm.f90 +++ b/fpm/src/fpm.f90 @@ -9,7 +9,7 @@ use fpm_filesystem, only: is_dir, join_path, number_of_rows, list_files, exists, 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 +use fpm_compiler, only: get_module_flags, is_unknown_compiler use fpm_sources, only: add_executable_sources, add_sources_from_dir @@ -62,6 +62,11 @@ subroutine build_model(model, settings, package, error) model%fortran_compiler = settings%compiler endif + if (is_unknown_compiler(model%fortran_compiler)) then + write(*, '(*(a:,1x))') & + "<WARN>", "Unknown compiler", model%fortran_compiler, "requested!", & + "Defaults for this compiler might be incorrect" + end if model%output_directory = join_path('build',basename(model%fortran_compiler)//'_'//settings%build_name) call get_module_flags(model%fortran_compiler, & diff --git a/fpm/src/fpm_command_line.f90 b/fpm/src/fpm_command_line.f90 index 1326ee5..9d95977 100644 --- a/fpm/src/fpm_command_line.f90 +++ b/fpm/src/fpm_command_line.f90 @@ -156,7 +156,7 @@ contains & --target " " & & --list F & & --all F & - & --profile "default"& + & --profile " "& & --example F& & --runner " " & & --compiler "'//get_env('FPM_COMPILER','gfortran')//'" & @@ -206,7 +206,7 @@ contains case('build') call set_args( '& - & --profile "default" & + & --profile " " & & --list F & & --show-model F & & --compiler "'//get_env('FPM_COMPILER','gfortran')//'" & @@ -345,7 +345,7 @@ contains call printhelp(help_text) case('install') - call set_args('--profile "default" --no-rebuild F --verbose F --prefix " " & + call set_args('--profile " " --no-rebuild F --verbose F --prefix " " & & --list F & & --compiler "'//get_env('FPM_COMPILER','gfortran')//'" & & --flag:: " "& @@ -382,7 +382,7 @@ contains call set_args('& & --target " " & & --list F& - & --profile "default"& + & --profile " "& & --runner " " & & --compiler "'//get_env('FPM_COMPILER','gfortran')//'" & & --flag:: " "& diff --git a/fpm/src/fpm_compiler.f90 b/fpm/src/fpm_compiler.f90 index 5aee143..51cda20 100644 --- a/fpm/src/fpm_compiler.f90 +++ b/fpm/src/fpm_compiler.f90 @@ -29,6 +29,7 @@ module fpm_compiler use fpm_model, only: fpm_model_t use fpm_filesystem, only: join_path, basename implicit none +public :: is_unknown_compiler public :: get_module_flags public :: get_default_compile_flags public :: get_debug_compile_flags @@ -323,4 +324,10 @@ function check_compiler(compiler, expected) result(match) end if end function check_compiler +function is_unknown_compiler(compiler) result(is_unknown) + character(len=*), intent(in) :: compiler + logical :: is_unknown + is_unknown = get_compiler_id(compiler) == id_unknown +end function is_unknown_compiler + end module fpm_compiler |