Skip to content

Commit e14e4da

Browse files
committed
safe on empty %cxx
1 parent 0699dfe commit e14e4da

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/fpm_compiler.F90

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -933,19 +933,22 @@ subroutine get_default_cxx_compiler(f_compiler, cxx_compiler)
933933
end subroutine get_default_cxx_compiler
934934

935935
!> Check if C++ compiler is GNU-based by checking its version output
936-
function is_cxx_gnu_based(cxx_compiler) result(is_gnu)
937-
character(len=*), intent(in) :: cxx_compiler
936+
function is_cxx_gnu_based(self) result(is_gnu)
937+
class(compiler_t), intent(in) :: self
938938
logical :: is_gnu
939939
character(len=:), allocatable :: output_file, version_output
940940
integer :: stat, io
941941

942942
is_gnu = .false.
943+
944+
if (.not.allocated(self%cxx)) return
945+
if (len_trim(self%cxx)<=0) return
943946

944947
! Get temporary file for compiler version output
945948
output_file = get_temp_filename()
946949

947950
! Run compiler with --version to get version info
948-
call run(cxx_compiler//" --version > "//output_file//" 2>&1", &
951+
call run(self%cxx//" --version > "//output_file//" 2>&1", &
949952
echo=.false., exitstat=stat)
950953

951954
if (stat == 0) then

src/fpm_targets.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ subroutine build_target_list(targets,model,library)
329329
if (n_source < 1) return
330330

331331
if (get_os_type()==OS_MACOS) then
332-
clang_cxx_backend_macos = .not. is_cxx_gnu_based(model%compiler%cxx)
332+
clang_cxx_backend_macos = .not. is_cxx_gnu_based(model%compiler)
333333
else
334334
clang_cxx_backend_macos = .false.
335335
endif

0 commit comments

Comments
 (0)