Trump said that the bill will also help fund a "major upgrade" to the country's missile defense system.
Trump added that a strong military requires a robust USA economy, which he said helps provide funding for new equipment, pay increases for soldiers and reduces the unemployment rate for veterans.
"We have the best spirit, the best soldiers, ever to set foot on any battlefield, anywhere, at any time", he said, asserting that the United States was respected again. "And that's what we did", Trump said. It provides $717 billion for military funding, which Trump described as historic.
Trump later made a reference to McCain at a political fundraiser in Utica, New York, knocking him - as Trump does repeatedly - for voting against a bill to repeal parts of President Barack Obama's signature healthcare reform law previous year. The White House has said it will outline a budget for the space force next year.
The compromise bill removes a provision reinstating penalties against ZTE and restricting the company's ability to buy USA component parts.
The bill also directs the Secretary of Defense to study whether Turkey's planned deployment of the Russian-made S-400 missile defense system will risk the security of several US -made weapons used by Turkey, including the F-35 jet.
Trump has lifted an earlier ban on US companies selling to ZTE, allowing China's second-largest telecommunications equipment maker to resume business and putting him at odds with both Republican and Democratic lawmakers.
The measure also includes provisions created to improve how the Defense Department handles reports of sexual assaults among the tens of thousands of children and teens who live and go to school on the military bases where their parents serve.
McCain has been a regular target of presidential ridicule from Trump, who has mocked the senator's thumbs down vote against the Senate GOP bill to roll back parts of the 2010 health care law.
For his part, McCain has always been critical of Trump.
In May, a West Wing aide dismissed McCain's negative opinion on Trump's Central Intelligence Agency nominee during a closed-door meeting by saying of the senator that "he's dying anyway".
The president studiously avoided reading the official name of the legislation - which would have meant mentioning McCain - during the 28-minute speech or during the signing ceremony afterward.
In a statement, McCain, who is battling brain cancer, said he was "humbled that my colleagues in Congress chose to designate this bill in my name".
Trump never mentioned Sen.