## =================================
FIND_FILE(
- cpPlugins_FUNCTIONS
+ cpPlugins_Functions_cmake
NAMES cpPlugins_Functions.cmake
HINTS /usr/share/cmake /usr/local/share/cmake
PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
DOC "Where is \"cpPlugins_Functions.cmake\"?"
)
-IF(NOT cpPlugins_FUNCTIONS)
+IF(NOT cpPlugins_Functions_cmake)
MESSAGE(FATAL_ERROR "Where is \"cpPlugins_Functions.cmake\"?")
-ENDIF(NOT cpPlugins_FUNCTIONS)
-GET_FILENAME_COMPONENT(
- cpPlugins_FUNCTIONS_ABSOLUTE ${cpPlugins_FUNCTIONS}
- ABSOLUTE
- )
-GET_FILENAME_COMPONENT(
- cpPlugins_CMAKE_DIR ${cpPlugins_FUNCTIONS_ABSOLUTE}
- DIRECTORY
- )
+ENDIF(NOT cpPlugins_Functions_cmake)
+INCLUDE(${cpPlugins_Functions_cmake})
-## ===========================
-## == Include cmake scripts ==
-## ===========================
+FIND_FILE(
+ cpPlugins_Options_cmake
+ NAMES cpPlugins_Options.cmake
+ HINTS /usr/share/cmake /usr/local/share/cmake
+ PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
+ DOC "Where is \"cpPlugins_Options.cmake\"?"
+ )
+IF(NOT cpPlugins_Options_cmake)
+ MESSAGE(FATAL_ERROR "Where is \"cpPlugins_Options.cmake\"?")
+ENDIF(NOT cpPlugins_Options_cmake)
+INCLUDE(${cpPlugins_Options_cmake})
-INCLUDE(${cpPlugins_FUNCTIONS})
-INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Options.cmake)
+## =========================
+## == Find base libraries ==
+## =========================
SET(ITK_DIR @ITK_DIR@)
SET(VTK_DIR @VTK_DIR@)
-INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_KitwareTools.cmake)
+FIND_PACKAGE(ITK REQUIRED)
+FIND_PACKAGE(VTK REQUIRED)
+INCLUDE(${ITK_USE_FILE})
+INCLUDE(${VTK_USE_FILE})
+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)
SET(USE_QT4 "@QT4_FOUND@")
IF(USE_QT4 EQUAL "1")
- INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Qt4Tools.cmake)
- cpPlugins_FindQt4()
SET(QT_QMAKE_EXECUTABLE @QT_QMAKE_EXECUTABLE@)
+ FIND_PACKAGE(Qt4 REQUIRED)
+ INCLUDE(${QT_USE_FILE})
+ SET(
+ _required_vtk_modules
+ vtkGUISupportQt
+ vtkGUISupportQtOpenGL
+ )
+ FOREACH(_m ${_required_vtk_modules})
+ IF(NOT ${_m}_LOADED)
+ MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
+ BREAK()
+ ENDIF(NOT ${_m}_LOADED)
+ ENDFOREACH(_m)
+ SET(QT4_FOUND "1")
ENDIF(USE_QT4 EQUAL "1")
## =========================
## == Include directories ==
## =========================
+## TODO: this is not completely correct!!!
INCLUDE_DIRECTORIES(
@CMAKE_INSTALL_PREFIX@/include
@CMAKE_INSTALL_PREFIX@/include/cpPlugins/Itk2Vtk
@PROJECT_BINARY_DIR@/lib/Instances
)
-## =========================
-## == 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 ==
-## ===================
+## ===================================
+## == Library names and directories ==
+## ===================================
SET(cpPlugins_tinyxml2_LIB "@cpPlugins_tinyxml2_LIB@")
SET(cpExtensions_LIB "@cpExtensions_LIB@")
SET(cpPlugins_LIB "@cpPlugins_LIB@")
SET(cpBaseQtApplication_LIB "@cpBaseQtApplication_LIB@")
SET(cpPlugins_Instances "@cpPlugins_Instances@")
+SET(
+ _all_libs
+ ${cpPlugins_tinyxml2_LIB}
+ ${cpExtensions_LIB}
+ ${cpPlugins_LIB}
+ ${cpBaseQtApplication_LIB}
+ ${cpPlugins_Instances}
+ )
+
+SET(_l_locations)
+FOREACH(_l ${_all_libs})
+ SET(cpPlugins_library_location)
+ IF(MSVC)
+ FIND_LIBRARY(
+ cpPlugins_library_location_${_l} NAMES ${_l}
+ HINTS
+ @PROJECT_BINARY_DIR@/$(ConfigurationName)
+ @CMAKE_INSTALL_PREFIX@/bin
+ @CMAKE_INSTALL_PREFIX@/lib
+ )
+ ELSE(MSVC)
+ FIND_LIBRARY(
+ cpPlugins_library_location_${_l} NAMES ${_l}
+ HINTS
+ @PROJECT_BINARY_DIR@
+ @CMAKE_INSTALL_PREFIX@/bin
+ @CMAKE_INSTALL_PREFIX@/lib
+ )
+ ENDIF(MSVC)
+ MARK_AS_ADVANCED(FORCE cpPlugins_library_location_${_l})
+ IF(cpPlugins_library_location_${_l})
+ GET_FILENAME_COMPONENT(_dir ${cpPlugins_library_location_${_l}} DIRECTORY)
+ LIST(APPEND _l_locations ${_dir})
+ ENDIF(cpPlugins_library_location_${_l})
+ENDFOREACH(_l)
+IF(_l_locations)
+ LIST(REMOVE_DUPLICATES _l_locations)
+ LINK_DIRECTORIES(${_l_locations})
+ENDIF(_l_locations)
## ======================
## == Executable names ==
## ======================
+
SET(
- exec_PROGRAMS
- cpPlugins_CreateInstances
- cpPlugins_HostCreator
+ _exec_programs
+ @cpPlugins_CreateInstances_APP@
+ @cpPlugins_HostCreator_APP@
+ @cpPlugins_ExecuteWorkspace_APP@
)
-FOREACH(prog ${exec_PROGRAMS})
+
+FOREACH(prog ${_exec_programs})
IF(MSVC)
FIND_PROGRAM(
${prog}_APP
NAMES ${prog}
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
+ PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@/$(ConfigurationName)
PATH_SUFFIXES bin sbin
DOC "Where is ${prog}?"
)
ENDIF(MSVC)
ENDFOREACH(prog)
-## eof - $RCSfile$
+# ## eof - $RCSfile$