Let $G_1$ and $G_2$ be compact connected (not necessarily semi-simple) Lie groups. Assume that the underlying smooth manifolds of $G_1$ and $G_2$ are diffeomorphic and that the underlying abstract groups are isomorphic. Is it true that $G_1$ and $G_2$ are isomorphic as topological groups? I believe that by Scheerer's theorem we know that universal covers are isomorphic.

P.S.: it is true that there has been a lot of variations of this question on this site but I believe this exact question has not been answered yet:

- Compact connected Lie groups may have diffeomorphic underlying smooth manifolds, yet fail to be isomorphic as topological groups
- There is a unique compact Lie group whose underlying smooth manifold is diffeomorphic to 3-dimensional real projective space
- There exist many compact connected topological groups whose underlying abstract group is isomorphic to the torus but underlying space is not homeomorphic to the torus
- There exist non-compact connected Lie groups whose underlying smooth manifolds are diffeomorphic and whose underlying abstract groups are isomorphic

EDIT: Let us assume that we have proved that if two connected compact Lie groups are abstractly isomorphic, they are isomorphic (this is achieved in YCor's answer). I think the following argument extends this to general compact Lie groups.

Assume we have two compact Lie groups $G_1$, $G_2$ that are abstractly isomorphic. Note that in a compact Lie group, every subgroup of finite index is open (and open subgroups are closed), so every subgroup of finite index is a union of some connected components. Therefore, the identity component of a compact Lie group can be characterized as the subgroup of maximum finite index (which happens to be normal) and the group of connected components can be characterized as the maximum finite quotient. Therefore, from the abstract isomorphism class of $G_1$ and $G_2$ we recover extensions of Lie groups $$ 0\rightarrow (G_1)^0\rightarrow G_1\rightarrow \pi_0 G_1\rightarrow 0, $$ $$ 0\rightarrow (G_2)^0\rightarrow G_2\rightarrow \pi_0 G_2\rightarrow 0, $$ which are equivalent when considered as extensions of abstract groups (strictly speaking, we only know that there is an abstract isomorphism $G_1\rightarrow G_2$ and this by itself does not mean that the extensions are equivalent; but the above algebraic characterization of the identity component implies that any isomorphism $G_1\rightarrow G_2$ must send $(G_1)^0$ to $(G_2)^0$). We want to prove that these extensions are equivalent as extensions of Lie groups.

If we prove that for a connected compact Lie group $N$ and a finite Lie group $H$, the forgetful map from the set of equivalence classes of extensions of Lie groups to the set of equivalence classes of extensions of abstract groups $\mathrm{Ext}_{Lie}(H, N)\rightarrow \mathrm{Ext}_{Grp}(H, N)$ is an injection, we win. An extension of Lie groups $$ 0\rightarrow N\rightarrow G\rightarrow H\rightarrow 0 $$ defines a morphism of abstract groups $s:H\rightarrow \mathrm{OutAut}(N)$ called characteristic homomorphism (here $\mathrm{OutAut}(N)$ is the quotient of the group of smooth automorphisms of $N$ by the group of inner automorphisms, considered as the subgroup of $\mathrm{AbOutAut}(N)$, the group of abstract outer automorphisms of $N$). If two extensions are equivalent as extensions of abstract groups, they define the same characteristic homomorphisms so we have partitions $$ \mathrm{Ext}_{Lie}(H, N)=\bigcup_{s\in \mathrm{Hom}(H, \mathrm{OutAut}(N))} \mathrm{Ext}_{Lie}(H, N)_s, \qquad \mathrm{Ext}_{Grp}(H, N)=\bigcup_{s\in \mathrm{Hom}(H, \mathrm{AbOutAut}(N))} \mathrm{Ext}_{Grp}(H, N)_s $$ compatible with the forgetful map.

Now let $Z(N)$ denote the center of $N$ considered as an $H$-module via characteristic homomorphism. Theorem 18.1.13 (c) of "Structure and geometry of Lie groups" says that if $\mathrm{Ext}_{Lie}(H, N)_s$ is non-empty, then there is a bijection $H^2(H, Z(N))\rightarrow \mathrm{Ext}_{Lie}(H, N)_s$. Theorem 8.8. of MacLane's "Homology" says that if $\mathrm{Ext}_{Grp}(H, N)_s$ is non-empty, then there is a bijection $H^2(H, Z(N))\rightarrow \mathrm{Ext}_{Grp}(H, N)_s$. An inspection of the two proofs shows that these bijections are in fact compatible with the map $\mathrm{Ext}_{Lie}(H, N)_s\rightarrow\mathrm{Ext}_{Grp}(H, N)_s$, i.e. the 3 maps form a commutative triangle. Hence the map $\mathrm{Ext}_{Lie}(H, N)_s\rightarrow\mathrm{Ext}_{Grp}(H, N)_s$, being a composition of two bijections, is a bijection. Therefore, the forgetful map $\mathrm{Ext}_{Lie}(H, N)\rightarrow\mathrm{Ext}_{Grp}(H, N)$ is an injection (and it fails to be a surjection precisely because $\mathrm{OutAut}(N)\subsetneq \mathrm{AbOutAut}(N)$ for general compact connected Lie group).