When gluing wood moulding 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 2 basic types of wood glue suitable for attaching moulding. Which to use depends on the finishing touches you'll be applying as well as who you ask.
Polyvinyl Acetate and Polyurethane Glues
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 skin, too. Both types offer a range of set times, so depending on whom you ask, one or other is the better option.