I use the cheap wally-world brand latex caulk to hold the foam to wood, foam to cork, and even cork to track. Just lay down a good size bead, go back with a sheetrock blade to smooth it out, widen the bead, and thin it.
Easy to remove when its set, just wet it, and work it loose, or even using...