There are two ways you can handle this situation.
First one:
Parent the cylinder to the cuboid and then change the orientation to parent. Now depending upon the axes of the parent, simply R to rotate and X/Y to specify the axes and then type in 90.

Second:
It's almost similar to the first one. This time instead of parenting, select the cuboid and then just go to the orientation menu and click the Plus icon to have the orientation of the cuboid usable for any object. Just select the newly created custom orientation and do the same rotation stuff mentioned previously.

The only advantage you will get by using the second method is that you wont have to parent each and every object in a case where you have multiple objects. Otherwise just use the first method.

Here's a nice video by CG Cookie if you want all the details about this orientation stuff:
https://www.youtube.com/watch?v=QwLMk_tFvfU