]> Creatis software - cpPlugins.git/blobdiff - cmake/cpPluginsConfig.cmake.in
...
[cpPlugins.git] / cmake / cpPluginsConfig.cmake.in
index b46789024dea07b3c0796e9f8fdf5dbcbff439a1..0a65b42efeabb07bdecf7cfd486411f432caae69 100644 (file)
-# ===================================
-# -- 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})
+## ================================
+## == Find cpPlugins-cmake tools ==
+## ================================
+
+SET(ITK_DIR "@ITK_DIR@")
+SET(VTK_DIR "@VTK_DIR@")
+IF("@Qt4_FOUND@" STREQUAL "TRUE")
+  SET(BUILD_QT4_COMPONENTS ON)
+  SET(QT_QMAKE_EXECUTABLE "@QT_QMAKE_EXECUTABLE@")
+ENDIF("@Qt4_FOUND@" STREQUAL "TRUE")
+
+## ====================
+## == Find libraries ==
+## ====================
+
+SET(
+  cpPlugins_AllInstances
+  cpInstances_BaseObjects
+  cpInstances_Images
+  cpInstances_Geometries
+  cpInstances_Extensions
+  CACHE STRING "All instances from templated code"
+  )
+MARK_AS_ADVANCED(FORCE cpPlugins_AllInstances)
 
-  ## Check for required vtk-qt4 modules
-  SET(
-    vtk_required_modules
-    vtkGUISupportQt
-    vtkGUISupportQtOpenGL
+SET(
+  _all_libs
+  cpExtensions
+  cpPlugins
+  cpPluginsDataObjects
+  )
+IF(USE_QT4)
+  LIST(APPEND _all_libs cpBaseQtApplication)
+  LIST(APPEND _all_libs cp_QCustomPlot)
+ENDIF(USE_QT4)
+SET(cpPlugins_Libraries ${_all_libs} CACHE STRING "cpPlugins base libraries")
+MARK_AS_ADVANCED(FORCE cpPlugins_Libraries)
+
+SET(_all_libs ${cpPlugins_AllInstances} ${cpPlugins_Libraries})
+SET(_l_locations)
+FOREACH(_l ${_all_libs})
+  FIND_LIBRARY(
+    ${_l}_LIB NAMES ${_l}
+    PATHS
+    @PROJECT_BINARY_DIR@
+    @CMAKE_INSTALL_PREFIX@/bin
+    @CMAKE_INSTALL_PREFIX@/lib
+    ${_l_locations}
     )
-  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 --
-# =========================
-
+  IF(${_l}_LIB)
+    MARK_AS_ADVANCED(FORCE ${_l}_LIB)
+    GET_FILENAME_COMPONENT(_dir ${${_l}_LIB} DIRECTORY)
+    LIST(APPEND _l_locations ${_dir})
+    LIST(REMOVE_DUPLICATES _l_locations)
+  ENDIF(${_l}_LIB)
+ENDFOREACH(_l)
+IF(_l_locations)
+  LINK_DIRECTORIES(${_l_locations})
+ENDIF(_l_locations)
+
+## ==============================
+## == Find include directories ==
+## ==============================
+
+## TODO: this is not completely correct!!!
 INCLUDE_DIRECTORIES(
   @CMAKE_INSTALL_PREFIX@/include
-  @CMAKE_INSTALL_PREFIX@/include/third_party
-  @CMAKE_INSTALL_PREFIX@/include/ItkVtkGlue
+  @CMAKE_INSTALL_PREFIX@/include/cpPlugins/cpInstances
   @PROJECT_SOURCE_DIR@
   @PROJECT_BINARY_DIR@
   @PROJECT_SOURCE_DIR@/lib
   @PROJECT_BINARY_DIR@/lib
-  @PROJECT_SOURCE_DIR@/lib/cpPlugins_Instances
-  @PROJECT_BINARY_DIR@/lib/cpPlugins_Instances
-  @PROJECT_SOURCE_DIR@/plugins
-  @PROJECT_BINARY_DIR@/plugins
-  @PROJECT_SOURCE_DIR@/lib/third_party
-  @PROJECT_BINARY_DIR@/lib/third_party
-  @PROJECT_SOURCE_DIR@/lib/third_party/dirent
-  @PROJECT_BINARY_DIR@/lib/third_party/dirent
-  @PROJECT_SOURCE_DIR@/lib/ItkVtkGlue
-  @PROJECT_BINARY_DIR@/lib/ItkVtkGlue
+  @PROJECT_SOURCE_DIR@/lib/cpInstances
+  @PROJECT_BINARY_DIR@/lib/cpInstances
   )
 
-# =========================
-# -- Library directories --
-# =========================
-
-IF(MSVC)
-  LINK_DIRECTORIES(
-    @PROJECT_BINARY_DIR@/$(ConfigurationName)
-    @CMAKE_INSTALL_PREFIX@/bin
-    @CMAKE_INSTALL_PREFIX@/lib
-    )
-ELSE(MSVC)
-  LINK_DIRECTORIES(
-    @PROJECT_BINARY_DIR@
-    @CMAKE_INSTALL_PREFIX@/bin
-    @CMAKE_INSTALL_PREFIX@/lib
-    )
-ENDIF(MSVC)
-
-# ===================
-# -- Library names --
-# ===================
-
-SET(cpExtensions_LIBRARY cpExtensions)
-SET(cpPlugins_tinyxml2_LIBRARY cpPlugins_tinyxml2)
-SET(cpPlugins_ALL_INSTANCES_LIBRARIES "@cpPlugins_ALL_INSTANCES@")
-SET(cpPlugins_LIBRARY cpPlugins)
-SET(cpPipelineEditor_LIBRARY cpPipelineEditor)
-
-# ======================
-# -- Executable names --
-# ======================
+## ============================
+## == Find bash applications ==
+## ============================
+
+SET(
+  _exec_programs
+  "@cpPlugins_bash_CreateRealConfig_APP@"
+  "@cpPlugins_bash_CreateInstances_APP@"
+  "@cpPlugins_bash_CreateDemanglers_APP@"
+  "@cpPlugins_bash_CreatePlugins_APP@"
+  "@cpPlugins_bash_HostCreator_APP@"
+  )
 
-IF(MSVC)
-  FIND_PROGRAM(
-    cpPlugins_HostCreator_APP
-    NAMES cpPlugins_HostCreator
-    HINTS /usr /usr/local
-    PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@/Debug @PROJECT_BINARY_DIR@/Release @PROJECT_BINARY_DIR@/MinSizeRel @PROJECT_BINARY_DIR@/RelWithDebInfo
-    PATH_SUFFIXES bin sbin
-    DOC "Where is cpPlugins_HostCreator?"
-    )
-ELSE(MSVC)
+SET(_b_locations)
+FOREACH(_p ${_exec_programs})
   FIND_PROGRAM(
-    cpPlugins_HostCreator_APP
-    NAMES cpPlugins_HostCreator
+    ${_p}_APP
+    NAMES ${_p}
     HINTS /usr /usr/local
-    PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@
+    PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@ ${_b_locations}
     PATH_SUFFIXES bin sbin
-    DOC "Where is cpPlugins_HostCreator?"
+    DOC "Where is ${_prog}?"
     )
-ENDIF(MSVC)
+  IF(${_p}_APP)
+    MARK_AS_ADVANCED(FORCE ${_p}_APP)
+    GET_FILENAME_COMPONENT(_dir ${${_p}_APP} DIRECTORY)
+    LIST(APPEND _b_locations ${_dir})
+    LIST(REMOVE_DUPLICATES _b_locations)
+  ENDIF(${_p}_APP)
+ENDFOREACH(_p)
+
+## ==========================
+## == Configuration values ==
+## ==========================
+
+SET(cpPlugins_NUMBER_OF_FILES "@cpPlugins_NUMBER_OF_FILES@" CACHE STRING "Internal")
+SET(cpPlugins_PROCESS_DIMS "@cpPlugins_PROCESS_DIMS@" CACHE STRING "Internal")
+SET(cpPlugins_VISUAL_DIMS "@cpPlugins_VISUAL_DIMS@" CACHE STRING "Internal")
+
+MARK_AS_ADVANCED(FORCE cpPlugins_NUMBER_OF_FILES)
+MARK_AS_ADVANCED(FORCE cpPlugins_PROCESS_DIMS)
+MARK_AS_ADVANCED(FORCE cpPlugins_VISUAL_DIMS)
 
 ## eof - $RCSfile$