-# ===================================
-# -- Some configurations variables --
-# ===================================
-
-SET(USE_QT4 "@QT4_FOUND@")
-
-# =======================
-# -- Find dependencies --
-# =======================
-
-# Find ITK and VTK
-SET(ITK_DIR @ITK_DIR@)
-FIND_PACKAGE(ITK REQUIRED)
-INCLUDE(${ITK_USE_FILE})
-
-SET(VTK_DIR @VTK_DIR@)
-FIND_PACKAGE(VTK REQUIRED)
-INCLUDE(${VTK_USE_FILE})
-
-# Do not use itk-vtk glue --> problems ahead!!!
-IF(ITKVtkGlue_LOADED)
- MESSAGE(FATAL_ERROR "ITKVtkGlue module is available. Please re-compile your ITK without it. It could lead to nasty compilation problems... Just waiting for Kitware to solve it.")
-ENDIF(ITKVtkGlue_LOADED)
-
-IF(USE_QT4 EQUAL "1")
- SET(QT_QMAKE_EXECUTABLE @QT_QMAKE_EXECUTABLE@)
- FIND_PACKAGE(Qt4 REQUIRED)
- INCLUDE(${QT_USE_FILE})
-
- ## Check for required vtk-qt4 modules
- SET(
- vtk_required_modules
- vtkGUISupportQt
- vtkGUISupportQtOpenGL
- )
- FOREACH(vtk_module ${vtk_required_modules})
- IF(NOT ${vtk_module}_LOADED)
- MESSAGE(
- FATAL_ERROR
- "${vtk_module} module is required but not available."
- )
- ENDIF(NOT ${vtk_module}_LOADED)
- ENDFOREACH(vtk_module)
-ENDIF(USE_QT4 EQUAL "1")
-
-
-# =========================
-# -- Include directories --
-# =========================
-
+## ================================
+## == Find cpPlugins-cmake tools ==
+## ================================
+
+IF("@Qt4_FOUND@" STREQUAL "TRUE")
+ SET(USE_QT4 ON)
+ENDIF("@Qt4_FOUND@" STREQUAL "TRUE")
+
+## ====================
+## == Find libraries ==
+## ====================
+
+SET(cpPlugins_BaseLibraries "@cpPlugins_BaseLibraries@" CACHE STRING "Internal")
+SET(cpPlugins_AllInstances "@cpPlugins_AllInstances@" CACHE STRING "Internal")
+MARK_AS_ADVANCED(FORCE cpPlugins_BaseLibraries)
+MARK_AS_ADVANCED(FORCE cpPlugins_AllInstances)
+
+SET(_all_libs ${cpPlugins_BaseLibraries} ${cpPlugins_AllInstances})
+
+SET(_l_locations)
+FOREACH(_l ${_all_libs})
+ IF(MSVC)
+ FIND_LIBRARY(
+ ${_l}_LIB NAMES ${_l}
+ HINTS
+ @PROJECT_BINARY_DIR@/$(ConfigurationName)
+ @CMAKE_INSTALL_PREFIX@/bin
+ @CMAKE_INSTALL_PREFIX@/lib
+ )
+ ELSE(MSVC)
+ FIND_LIBRARY(
+ ${_l}_LIB NAMES ${_l}
+ HINTS
+ @PROJECT_BINARY_DIR@
+ @CMAKE_INSTALL_PREFIX@/bin
+ @CMAKE_INSTALL_PREFIX@/lib
+ )
+ ENDIF(MSVC)
+ IF(${_l}_LIB)
+ MARK_AS_ADVANCED(FORCE ${_l}_LIB)
+ GET_FILENAME_COMPONENT(_dir ${${_l}_LIB} DIRECTORY)
+ LIST(APPEND _l_locations ${_dir})
+ ENDIF(${_l}_LIB)
+ENDFOREACH(_l)
+IF(_l_locations)
+ LIST(REMOVE_DUPLICATES _l_locations)
+ LINK_DIRECTORIES(${_l_locations})
+ENDIF(_l_locations)
+
+## ==============================
+## == Find include directories ==
+## ==============================
+
+## TODO: this is not completely correct!!!