SET(MESHGEMS_ROOT_DIR $ENV{MESHGEMS_ROOT_DIR})
-FIND_PATH(MESHGEMS_INCLUDE_DIRS meshgems/cadsurf.h ${MESHGEMS_ROOT_DIR}/include)
+FIND_PATH(MESHGEMS_INCLUDE_DIRS meshgems/cadsurf.h HINTS ${MESHGEMS_ROOT_DIR} PATH_SUFFIXES include)
-SET(CADSURF_LIBS_PATHS)
-SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMS_ROOT_DIR}/lib)
-
-SET(suff)
IF(MACHINE_IS_64)
- SET(suff "_64")
+ SET(_suff "_64")
+ELSE()
+ SET(_suff)
ENDIF(MACHINE_IS_64)
-
-IF(WIN32)
- SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMS_ROOT_DIR}/lib/WinXP${suff}_VC9)
-ELSE(WIN32)
- SET(CADSURF_LIBS_PATHS ${CADSURF_LIBS_PATHS} ${MESHGEMS_ROOT_DIR}/lib/Linux${suff})
+IF(WIN32)
+ SET(_plt WinXP${_suff}_VC9 WinXP${_suff}_VC10)
+ELSE()
+ SET(_plt Linux${_suff})
ENDIF(WIN32)
-FIND_LIBRARY(mg-cadsurf mg-cadsurf PATHS ${CADSURF_LIBS_PATHS})
-FIND_LIBRARY(mg-precad mg-precad PATHS ${CADSURF_LIBS_PATHS})
-FIND_LIBRARY(meshgems meshgems PATHS ${CADSURF_LIBS_PATHS})
+SET(CADSURF_LIBS_PATHS ${MESHGEMS_ROOT_DIR}/lib)
+
+FIND_LIBRARY(mg-cadsurf mg-cadsurf PATHS ${CADSURF_LIBS_PATHS} PATH_SUFFIXES ${_plt})
+FIND_LIBRARY(mg-precad mg-precad PATHS ${CADSURF_LIBS_PATHS} PATH_SUFFIXES ${_plt})
+FIND_LIBRARY(meshgems meshgems PATHS ${CADSURF_LIBS_PATHS} PATH_SUFFIXES ${_plt})
+# TODO: search all components
SET(MESHGEMS_LIBRARIES)
SET(MESHGEMS_LIBRARIES ${MESHGEMS_LIBRARIES} ${mg-cadsurf})
SET(MESHGEMS_LIBRARIES ${MESHGEMS_LIBRARIES} ${mg-precad})