to add to SDevalapurkar's answer:
Another good reference for the relationship between a compact (in the topological sense) Lie group and one whose Lie algebra is compact is S. Helgason "Differential geometry Lie groups and symmetric spaces"
Although you have to make the (small IMO) further assumption that the group has finite centre, you then have the following definitive characterisation:
Proposition: Given that a Lie group has a finite centre, then the Killing form on a group's Lie algebra is negative definite if and only if the group is compact (in the topological sense).
(i.e. we consider only the class of Lie groups with finite centres, not all Lie groups)
The proof is in Chap. II, section 6, prop. 6.6 of the Helgason reference I cite.