Before ultimately signing Tony Romo to a contract with a full value of $180 million over 10 years, CBS offered Peyton Manning Romo’s job, The Post has learned.

With CBS’ apprehension so great about where Romo’s salary might be headed and with ESPN so eager to sign him, CBS called for an audible in the middle of negotiations.

Manning is NFL TV’s white whale, pursued by networks since he retired, but never caught. CBS looked to replace Romo with Manning as Jim Nantz’s Super Bowl partner.

In the midst of the Romo talks, CBS offered Manning a contract that is believed to be in the range of $10 million to $12 million a year for five or six seasons, according to sources.

Manning, as is his style, was not quick to decide.

With Manning not biting and with a Super Bowl on CBS next year, as well as forthcoming negotiations for a new NFL TV contract, CBS went all-in on Romo, whom they very much wanted to keep.

This prevented ESPN from making its planned 10-year, $140 million offer, according to sources. If Romo had hit the open market, maybe ESPN would have bid higher.

On Friday, the Romo deal was agreed upon when CBS’ sports chairman, Sean McManus, and its division president, David Berson, consummated an agreement with Romo’s CAA agents, Tom Young and R.J. Gonser.

A contract of the magnitude of Romo’s had serious collaboration from the top of ViacomCBS, led by chairwoman Shari Redstone and its president, Bob Bakish.

The Post reported this story by speaking with executives, agents and broadcasters with knowledge of how Romo became the $180 million NFL analyst and how CBS thought about audibling — Omaha! Omaha! — with Manning.

CBS confirmed the Romo signing, but has not gone into any details about the contract. CAA declined comment.

On Friday, The Post reported that Romo’s contract was for “around $17 million per season” and “significantly more than five years.”

Romo’s salary is $17.5 million, but factoring in all the perks, it is worth $18 million a year, according to sources.

Romo is receiving a contract that is 18 times more than his rookie TV deal of three years for around $10 million, which McManus and Berson gave him when they showed the foresight to hire him off the field in 2017.

If CBS keeps the NFL for the next decade, Romo’s broadcast earnings of $190 million between his first two contracts will far surpass the $127 million, according to Spotrac, he earned during his 14 seasons as the Cowboys’ quarterback.

Romo’s earnings per year are at least $10 million more than fellow former Cowboys quarterback and Fox lead game analyst Troy Aikman receives. Aikman is believed to make in the $6.5 million-to-$7.5 million range, according to sources.

Romo’s average of $18 million per year is higher than the average salary of the NFL’s 32 starting quarterbacks this past season, which comes in at $16.3 million. This includes signal-callers such as Ben Roethlisberger and Cam Newton, who missed significant time due to injuries but are the clear starters for their teams.

If Manning had agreed, Romo would have surely headed to ABC/ESPN/Disney. Manning is famously deliberate and did not accept.

This left ViacomCBS wanting to prevent Disney/ESPN from stepping into the negotiating ring with Romo, who had been their No. 1 goal throughout.

ViacomCBS executives have determined that having the NFL is at the center of its future. With Disney/ABC/ESPN ready to spend big for more NFL to go along with “Monday Night Football” and, most importantly, wanting to add television’s No. 1 show, the Super Bowl, CBS went full steam to preserve Romo’s partnership with Nantz.

Since the news broke, the question that has been asked is: Is Romo really worth it? The games are what really make the ratings for TV’s most popular programming. A broadcaster can add prestige, but on games there is not much data to suggest more people watch depending on the booth.

The NFL would like ESPN to change its broadcast team from Joe Tessitore and Booger McFarland, but “Monday Night Football” ratings were up this season.

The audience for this Romo deal was not the average fan, though CBS is, of course, aware of Romo’s popularity and that played some factor.

In the end, it is about making the NFL happy, having it feel bigger. One of the most important owners on the TV committee is none other than Jerry Jones, who remains a big fan of Romo, his former Cowboys quarterback.

At the end of the day, when it heads into the next round of billion-dollar negotiations — with the future of its company very dependent on retaining the NFL and with the inability to find a marquee alternative — CBS wanted a star quarterback on its side.

It flirted with Drew Brees during a phone call before the Saints quarterback decided to continue playing, and went after Manning hard, but it was Romo whom it married for the next decade.

Now, ESPN will try again for Manning.