British Foreign Secretary David Cameron said on Friday the UK would work with whomever becomes U.S. president in November, when asked whether the election of Donald Trump would endanger the AUKUS military alliance.

"What we will do, as I'm sure an Australian government would do, is work with whoever becomes the president," Cameron told a press conference in Adelaide, after he and British Defence Secretary Grant Shapps met their Australian counterparts.

Australia said on Thursday it would spend billions on docks, shipyards and factories at home and in Britain for nuclear-powered submarines under the AUKUS security pact, and named Britain's BAE Systems to help build the boats. (Reporting by Alasdair Pal in Sydney; Editing by Christopher Cushing and Tom Hogue)