Skip to content

Commit ecb7311

Browse files
committed
Warn if the compiler is not correctly identified
1 parent 6e1ce8d commit ecb7311

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

fpm/src/fpm.f90

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module fpm
99
use fpm_model, only: fpm_model_t, srcfile_t, show_model, &
1010
FPM_SCOPE_UNKNOWN, FPM_SCOPE_LIB, FPM_SCOPE_DEP, &
1111
FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE, FPM_SCOPE_TEST
12-
use fpm_compiler, only: get_module_flags
12+
use fpm_compiler, only: get_module_flags, is_unknown_compiler
1313

1414

1515
use fpm_sources, only: add_executable_sources, add_sources_from_dir
@@ -62,6 +62,11 @@ subroutine build_model(model, settings, package, error)
6262
model%fortran_compiler = settings%compiler
6363
endif
6464

65+
if (is_unknown_compiler(model%fortran_compiler)) then
66+
write(*, '(*(a:,1x))') &
67+
"<WARN>", "Unknown compiler", model%fortran_compiler, "requested!", &
68+
"Defaults for this compiler might be incorrect"
69+
end if
6570
model%output_directory = join_path('build',basename(model%fortran_compiler)//'_'//settings%build_name)
6671

6772
call get_module_flags(model%fortran_compiler, &

fpm/src/fpm_command_line.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ subroutine get_command_line_settings(cmd_settings)
156156
& --target " " &
157157
& --list F &
158158
& --all F &
159-
& --profile "default"&
159+
& --profile " "&
160160
& --example F&
161161
& --runner " " &
162162
& --compiler "'//get_env('FPM_COMPILER','gfortran')//'" &
@@ -206,7 +206,7 @@ subroutine get_command_line_settings(cmd_settings)
206206

207207
case('build')
208208
call set_args( '&
209-
& --profile "default" &
209+
& --profile " " &
210210
& --list F &
211211
& --show-model F &
212212
& --compiler "'//get_env('FPM_COMPILER','gfortran')//'" &
@@ -345,7 +345,7 @@ subroutine get_command_line_settings(cmd_settings)
345345
call printhelp(help_text)
346346

347347
case('install')
348-
call set_args('--profile "default" --no-rebuild F --verbose F --prefix " " &
348+
call set_args('--profile " " --no-rebuild F --verbose F --prefix " " &
349349
& --list F &
350350
& --compiler "'//get_env('FPM_COMPILER','gfortran')//'" &
351351
& --flag:: " "&
@@ -382,7 +382,7 @@ subroutine get_command_line_settings(cmd_settings)
382382
call set_args('&
383383
& --target " " &
384384
& --list F&
385-
& --profile "default"&
385+
& --profile " "&
386386
& --runner " " &
387387
& --compiler "'//get_env('FPM_COMPILER','gfortran')//'" &
388388
& --flag:: " "&

fpm/src/fpm_compiler.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module fpm_compiler
2929
use fpm_model, only: fpm_model_t
3030
use fpm_filesystem, only: join_path, basename
3131
implicit none
32+
public :: is_unknown_compiler
3233
public :: get_module_flags
3334
public :: get_default_compile_flags
3435
public :: get_debug_compile_flags
@@ -323,4 +324,10 @@ function check_compiler(compiler, expected) result(match)
323324
end if
324325
end function check_compiler
325326

327+
function is_unknown_compiler(compiler) result(is_unknown)
328+
character(len=*), intent(in) :: compiler
329+
logical :: is_unknown
330+
is_unknown = get_compiler_id(compiler) == id_unknown
331+
end function is_unknown_compiler
332+
326333
end module fpm_compiler

0 commit comments

Comments
 (0)