diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-06-05 15:02:08 +0200 |
---|---|---|
committer | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-06-05 15:03:41 +0200 |
commit | 1dd45535600237b2790a61eccd9e0c6cbabbc826 (patch) | |
tree | a6d30a137510d42f4d733def90fd599e9190319c /src/fpm_compiler.f90 | |
parent | 87a2cbfda5ac064c754e493d41950fde72e05fc7 (diff) | |
download | fpm-1dd45535600237b2790a61eccd9e0c6cbabbc826.tar.gz fpm-1dd45535600237b2790a61eccd9e0c6cbabbc826.zip |
Redirect output when searching for archiver
Diffstat (limited to 'src/fpm_compiler.f90')
-rw-r--r-- | src/fpm_compiler.f90 | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index 389ba94..aac6173 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -27,7 +27,7 @@ ! Unisys ? ? ? ? ? discontinued module fpm_compiler use fpm_model, only: fpm_model_t -use fpm_filesystem, only: join_path, basename +use fpm_filesystem, only: join_path, basename, get_temp_filename use fpm_environment, only: & get_os_type, & OS_LINUX, & @@ -36,13 +36,15 @@ use fpm_environment, only: & OS_CYGWIN, & OS_SOLARIS, & OS_FREEBSD, & - OS_OPENBSD + OS_OPENBSD, & + OS_UNKNOWN implicit none public :: is_unknown_compiler public :: get_module_flags public :: get_default_compile_flags public :: get_debug_compile_flags public :: get_release_compile_flags +public :: get_archiver enum, bind(C) enumerator :: & @@ -464,4 +466,23 @@ function is_unknown_compiler(compiler) result(is_unknown) is_unknown = get_compiler_id(compiler) == id_unknown end function is_unknown_compiler + +function get_archiver() result(archiver) + character(:), allocatable :: archiver + integer :: estat, os_type + + os_type = get_os_type() + if (os_type /= OS_WINDOWS .and. os_type /= OS_UNKNOWN) then + archiver = "ar -rs " + else + call execute_command_line("ar --version > "//get_temp_filename(), & + & exitstat=estat) + if (estat /= 0) then + archiver = "lib /OUT:" + else + archiver = "ar -rs " + end if + end if +end function + end module fpm_compiler |