Entry point for the fpm-install subcommand
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fpm_install_settings), | intent(inout) | :: | settings |
Representation of the command line settings |
subroutine cmd_install(settings) !> Representation of the command line settings type(fpm_install_settings), intent(inout) :: settings type(package_config_t) :: package type(error_t), allocatable :: error type(fpm_model_t) :: model type(build_target_ptr), allocatable :: targets(:) type(installer_t) :: installer type(string_t), allocatable :: list(:) logical :: installable integer :: ntargets call get_package_data(package, "fpm.toml", error, apply_defaults=.true.) call handle_error(error) call build_model(model, settings, package, error) call handle_error(error) call targets_from_sources(targets, model, settings%prune, error) call handle_error(error) call install_info(output_unit, settings%list, targets, ntargets) if (settings%list) return installable = (allocated(package%library) .and. package%install%library) & .or. allocated(package%executable) .or. ntargets>0 if (.not.installable) then call fatal_error(error, "Project does not contain any installable targets") call handle_error(error) end if if (.not.settings%no_rebuild) then call build_package(targets,model,verbose=settings%verbose) end if call new_installer(installer, prefix=settings%prefix, & bindir=settings%bindir, libdir=settings%libdir, testdir=settings%testdir, & includedir=settings%includedir, & verbosity=merge(2, 1, settings%verbose)) if (allocated(package%library) .and. package%install%library) then call filter_library_targets(targets, list) if (size(list) > 0) then call installer%install_library(list(1)%s, error) call handle_error(error) call install_module_files(installer, targets, error) call handle_error(error) end if end if if (allocated(package%executable) .or. ntargets>0) then call install_executables(installer, targets, error) call handle_error(error) end if if (allocated(package%test) .and. (package%install%test .or. model%include_tests)) then call install_tests(installer, targets, error) call handle_error(error) end if end subroutine cmd_install