--- a/src/transmap/CMakeLists.txt
+++ b/src/transmap/CMakeLists.txt
@@ -3,13 +3,21 @@
 #build a shared library
 #ADD_LIBRARY(panotoolswrapper SHARED pttransform.c)
 
-ADD_DEFINITIONS(${VIPS_CFLAGS})
+# set include and library directories
+link_directories( ${VIPS_LIBRARY_DIRS}  )
+include_directories( ${VIPS_INCLUDE_DIRS}  )
 
 #for testing you probably need some test app too
 ADD_EXECUTABLE(testTmap transmap.c resample.c transform.c)
 
+# set special compiler flags.
+SET_TARGET_PROPERTIES(testTmap PROPERTIES COMPILE_FLAGS "${VIPS_CFLAGS_OTHER_STRING}")
+
+# set special linker flags
+SET_TARGET_PROPERTIES(testTmap PROPERTIES LINK_FLAGS "${VIPS_LDFLAGS_OTHER_STRING}")
+
 #link to the library
-TARGET_LINK_LIBRARIES(testTmap panoparser pano13 panotoolswrapper vips)
+TARGET_LINK_LIBRARIES(testTmap panoparser pano13 panotoolswrapper ${VIPS_LIBRARIES})
 
 
 #add an install target here