I recently inherited some OpenCV code. I installed openCV on my mac, built in in XCode, and then compiled and successfully ran my first openCV \"hello world\"-ish program.>
You can also have the computer guess you the libraries automatically:
CFLAGS = `pkg-config --cflags opencv` LDFLAGS = `pkg-config --libs opencv` -lm