diff options
-rw-r--r-- | Modules/FindVTK.cmake | 78 | ||||
-rw-r--r-- | Modules/UseVTKIncludes.cmake | 25 | ||||
-rw-r--r-- | Modules/UseVTKLibraries.cmake | 25 |
3 files changed, 119 insertions, 9 deletions
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake index 56bdc91..a026f63 100644 --- a/Modules/FindVTK.cmake +++ b/Modules/FindVTK.cmake @@ -1,16 +1,76 @@ # # Find the native VTK includes and library # +# This module defines +# +# VTK_INSTALL_PATH - where is the installed version of VTK +# VTK_SOURCE_PATH - where is VTK source code +# VTK_BIN_PATH - where is the binary tree (only defined if SOURCE_PATH is defined) +# USE_INSTALLED_VTK - sould an installed or source version of VTK be used +# + + +# +# Look for local source trees and builds of VTK +# +# look in the cmake list of recent source and bin dirs for this user +# +FIND_PATH(VTK_SOURCE_PATH Common/vtkObject.h + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereSource] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereSource2] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereSource3] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereSource4] + ../VTK + VTK + ) + +# +# If we found a source tree then set use_installed_vtk to 0 +# +IF (VTK_SOURCE_PATH) + SET (USE_INSTALLED_VTK 0 CACHE BOOL "Is an installed (versus source) version of VTK used") + # + # Look for a binary tree + # + FIND_PATH(VTK_BIN_PATH vtkConfigure.h + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] + ../VTKBIN + ../vtkbin + VTKBIN + vtkbin + ) +ELSE (VTK_SOURCE_PATH) + # look for the vtk header files in installed places + FIND_PATH(VTK_INSTALL_PATH include/vtk/vtkObject.h + /usr/local + /usr + ) + FIND_PATH(VTK_INSTALL_PATH include/vtkObject.h + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\Nightly] + ) + IF (VTK_INSTALL_PATH) + SET (USE_INSTALLED_VTK 1 CACHE BOOL "Is an installed (versus source) version of VTK used") + ENDIF (VTK_INSTALL_PATH) +ENDIF (VTK_SOURCE_PATH) + +IF (USE_INSTALLED_VTK) + # look for the vtk header files in installed places + FIND_PATH(VTK_INSTALL_PATH include/vtk/vtkObject.h + /usr/local + /usr + ) + FIND_PATH(VTK_INSTALL_PATH include/vtkObject.h + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\Nightly] + ) + IF (VTK_INSTALL_PATH) + SET (USE_INSTALLED_VTK 1 CACHE BOOL "Is an installed (versus source) version of VTK used") + ENDIF (VTK_INSTALL_PATH) +ENDIF (USE_INSTALLED_VTK) + -FIND_PATH(VTK_INCLUDE_PATH vtk.h -/usr/local/include -/usr/include -/usr/local/vtk -H:/usr/local/vtk -) -FIND_LIBRARY(VTK_LIB_PATH vtk.dll -PATHS /usr/lib /usr/local/lib /usr/local/vtk/lib H:/usr/local/vtk/lib -) diff --git a/Modules/UseVTKIncludes.cmake b/Modules/UseVTKIncludes.cmake new file mode 100644 index 0000000..82250ce --- /dev/null +++ b/Modules/UseVTKIncludes.cmake @@ -0,0 +1,25 @@ +# +# This module add the VTK include paths to a project +# It should be included after the FindVTK module +# +IF (USE_INSTALLED_VTK) + IF (VTK_INSTALL_PATH) + INCLUDE_DIRECTORIES ( ${VTK_INSTALL_PATH}/include ${VTK_INSTALL_PATH}/include/vtk ) + ENDIF (VTK_INSTALL_PATH) +ELSE (USE_INSTALLED_VTK) + IF (VTK_SOURCE_PATH) + INCLUDE_DIRECTORIES( + ${VTK_SOURCE_PATH}/Common + ${VTK_SOURCE_PATH}/Filtering + ${VTK_SOURCE_PATH}/IO + ${VTK_SOURCE_PATH}/Graphics + ${VTK_SOURCE_PATH}/Imaging + ${VTK_SOURCE_PATH}/Rendering + ${VTK_SOURCE_PATH}/Hybrid + ${VTK_SOURCE_PATH}/Patented + ${VTK_SOURCE_PATH}/Parallel) + ENDIF (VTK_SOURCE_PATH) + IF (VTK_BIN_PATH) + INCLUDE_DIRECTORIES( ${VTK_BIN_PATH) ) + ENDIF (VTK_BIN_PATH) +ENDIF (USE_INSTALLED_VTK) diff --git a/Modules/UseVTKLibraries.cmake b/Modules/UseVTKLibraries.cmake new file mode 100644 index 0000000..89f801f --- /dev/null +++ b/Modules/UseVTKLibraries.cmake @@ -0,0 +1,25 @@ +# +# This module add the VTK include paths to a project +# It should be included after the FindVTK module +# +IF (USE_INSTALLED_VTK) + IF (VTK_INSTALL_PATH) + LINK_DIRECTORIES ( ${VTK_INSTALL_PATH}/lib ) + ENDIF (VTK_INSTALL_PATH) +ELSE (USE_INSTALLED_VTK) + IF (VTK_SOURCE_PATH) + INCLUDE_DIRECTORIES( + ${VTK_SOURCE_PATH}/Common + ${VTK_SOURCE_PATH}/Filtering + ${VTK_SOURCE_PATH}/IO + ${VTK_SOURCE_PATH}/Graphics + ${VTK_SOURCE_PATH}/Imaging + ${VTK_SOURCE_PATH}/Rendering + ${VTK_SOURCE_PATH}/Hybrid + ${VTK_SOURCE_PATH}/Patented + ${VTK_SOURCE_PATH}/Parallel) + ENDIF (VTK_SOURCE_PATH) + IF (VTK_BIN_PATH) + INCLUDE_DIRECTORIES( ${VTK_BIN_PATH) ) + ENDIF (VTK_BIN_PATH) +ENDIF (USE_INSTALLED_VTK) |