When gluing wood molding to cabinets, it's important to use the right kind of glue. The term "wood glue" is a bit too general, although you've got the right idea. There are two basic types of wood glue suitable for attaching molding. Which to use depends on the finishing touches you'll be applying as well as who you ask.
Polyvinyl acetate or PVA is perhaps the most common wood-to-wood glue in use. It won't work for gluing non-porous materials like metal or plastic. Polyurethane resin (PUR) is arguably stronger than PVA. It reacts with moisture and expands to fill all spaces and joints.
Polyurethane glue is also easy to sand and accepts stain well. PURs are costlier than PVAs. They are harder to remove from the skin. Both types offer a range of set times, so depending on whom you ask, one or the other is the better option.