2
# Find the native VTK includes and library
6
# VTK_INSTALL_PATH - Where is the installed version of VTK.
7
# USE_BUILT_VTK - Should a built-from-source version of VTK be used.
9
# VTK_BINARY_PATH - Where is (one of) the binary tree(s).
10
# USE_INSTALLED_VTK - Should an installed version of VTK be used
12
# USE_VTK_FILE - (internal)
13
# Full path and location to the UseVTK.cmake file.
14
# This value changes each time USE_BUILT_VTK or
15
# USE_INSTALLED_VTK is modified, and only if ONE of
16
# these setting is set to ON.
20
# Look for a binary tree (built from source)
22
FIND_PATH(VTK_BINARY_PATH UseVTK.cmake
23
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
24
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
25
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
26
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
27
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
28
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
29
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
30
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
31
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
32
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
42
# If we found a built tree, USE_BUILT_VTK allows the user to
43
# use it or not. Defaults to ON.
46
SET (USE_BUILT_VTK 1 CACHE BOOL
47
"Use a built (versus installed) version of VTK. Be sure that VTK_BINARY_PATH is correct.")
48
ENDIF (VTK_BINARY_PATH)
51
# Look for an installed tree
53
FIND_PATH(VTK_INSTALL_PATH include/vtk/UseVTK.cmake
56
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\Nightly]
57
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\43]
58
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\42]
59
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\41]
60
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\VTK\\40]
64
# If we found an installed tree, USE_INSTALLED_VTK allows the user to
67
# Defaults to OFF if a built tree was found before (see above), ON otherwise.
71
SET (USE_INSTALLED_VTK 0 CACHE BOOL
72
"Use an installed (versus built from source) version of VTK. Be sure that VTK_INSTALL_PATH is correct.")
74
SET (USE_INSTALLED_VTK 1 CACHE BOOL
75
"Use an installed (versus built from source) version of VTK. Be sure that VTK_INSTALL_PATH is correct.")
77
ENDIF (VTK_INSTALL_PATH)
80
# Set the USE_VTK_FILE only if one of USE_BUILT_VTK or USE_INSTALLED_VTK
84
IF (NOT USE_INSTALLED_VTK)
85
IF (EXISTS "${VTK_BINARY_PATH}/UseVTK.cmake")
86
SET (USE_VTK_FILE "${VTK_BINARY_PATH}/UseVTK.cmake")
87
ENDIF (EXISTS "${VTK_BINARY_PATH}/UseVTK.cmake")
88
ENDIF (NOT USE_INSTALLED_VTK)
90
IF (USE_INSTALLED_VTK)
91
IF (EXISTS "${VTK_INSTALL_PATH}/include/vtk/UseVTK.cmake")
92
SET (USE_VTK_FILE "${VTK_INSTALL_PATH}/include/vtk/UseVTK.cmake")
93
ENDIF (EXISTS "${VTK_INSTALL_PATH}/include/vtk/UseVTK.cmake")
94
ENDIF (USE_INSTALLED_VTK)
98
# Display a warning if both settings are set to ON.
99
# Otherwise display a warning if VTK was not found.
101
IF (USE_BUILT_VTK AND USE_INSTALLED_VTK)
102
MESSAGE ("Warning. Please make sure that only ONE of the USE_INSTALLED_VTK or USE_BUILT_VTK setting is set to ON.")
103
ELSE (USE_BUILT_VTK AND USE_INSTALLED_VTK)
104
IF (NOT USE_VTK_FILE)
105
MESSAGE ("Warning. VTK might be found on your system as different flavours: installed VTK or built VTK. Please make sure that the VTK_INSTALL_PATH or VTK_BINARY_PATH setting reflects which VTK you are planning to use, then set ONE of the USE_INSTALLED_VTK or USE_BUILT_VTK setting to ON.")
106
ENDIF (NOT USE_VTK_FILE)
107
ENDIF (USE_BUILT_VTK AND USE_INSTALLED_VTK)
111
# If you use that module then you are probably relying on VTK to be found
112
# on your system. Here is the CMake code you might probably want to use to
113
# work hand-in-hand with that module (in that example CAN_BUILD is a var
114
# that is set to 0 if your project can not be build):
116
# INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
119
# INCLUDE (${USE_VTK_FILE})
120
# ELSE (USE_VTK_FILE)
122
# ENDIF (USE_VTK_FILE)
2
# Find a VTK installation or build tree.
4
# The following variables are set if VTK is found. If VTK is not
5
# found, VTK_FOUND is set to false.
7
# VTK_FOUND - Set to true when VTK is found.
8
# VTK_USE_FILE - CMake source file to setup a project to use VTK.
9
# VTK_MAJOR_VERSION - The VTK major version number.
10
# VTK_MINOR_VERSION - The VTK minor version number (odd for non-release).
11
# VTK_BUILD_VERSION - The VTK patch level (meaningless for odd minor).
12
# VTK_INCLUDE_DIRS - Include directories for VTK headers.
13
# VTK_LIBRARY_DIRS - Link directories for VTK libraries.
14
# VTK_KITS - List of VTK kits, in all CAPS (COMMON, IO, ...).
15
# VTK_LANGUAGES - List of wrapped languages, in all CAPS (TCL, ...).
17
# The following cache entries must be set by the user to locate VTK:
19
# VTK_DIR - The directory containing VTKConfig.cmake. This is either
20
# the root of the build tree, or the lib/vtk
21
# directory. This is the only cache entry.
23
# The following variables are set for backward compatability and
24
# should not be used in new code:
26
# USE_VTK_FILE - The full path to the UseVTK.cmake file. This is provided
27
# for backward compatability. Use VTK_USE_FILE instead.
30
# Construct consitent error messages for use below.
31
SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation. For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.")
32
SET(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}")
34
# Search only if the location is not already known.
36
# Get the system search path as a list.
38
STRING(REGEX MATCHALL "[^:]+" VTK_DIR_SEARCH1 "$ENV{PATH}")
40
STRING(REGEX REPLACE "\\\\" "/" VTK_DIR_SEARCH1 "$ENV{PATH}")
42
STRING(REGEX REPLACE "/;" ";" VTK_DIR_SEARCH2 "${VTK_DIR_SEARCH1}")
44
# Construct a set of paths relative to the system search path.
45
SET(VTK_DIR_SEARCH "")
46
FOREACH(dir ${VTK_DIR_SEARCH2})
47
SET(VTK_DIR_SEARCH ${VTK_DIR_SEARCH} "${dir}/../lib/vtk")
50
# Old scripts may set these directories in the CMakeCache.txt file.
51
# They can tell us where to find VTKConfig.cmake.
52
SET(VTK_DIR_SEARCH_LEGACY "")
53
IF(VTK_BINARY_PATH AND USE_BUILT_VTK)
54
SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH})
55
ENDIF(VTK_BINARY_PATH AND USE_BUILT_VTK)
56
IF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
57
SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY}
58
${VTK_INSTALL_PATH}/lib/vtk)
59
ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
62
# Look for an installation or build tree.
64
FIND_PATH(VTK_DIR UseVTK.cmake
65
# Support legacy cache files.
66
${VTK_DIR_SEARCH_LEGACY}
68
# Look for an environment variable VTK_DIR.
71
# Look in places relative to the system executable search path.
74
# Look in standard UNIX install locations.
78
# Read from the CMakeSetup registry entries. It is likely that
79
# VTK will have been recently built.
80
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
81
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
82
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
83
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
84
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
85
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
86
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
87
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
88
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
89
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
91
# Help the user find it if we cannot.
92
DOC "The ${VTK_DIR_DESCRIPTION}"
96
# If VTK was found, load the configuration file to get the rest of the
99
# Make sure the VTKConfig.cmake file exists in the directory provided.
100
IF(EXISTS ${VTK_DIR}/VTKConfig.cmake)
102
# We found VTK. Load the settings.
104
INCLUDE(${VTK_DIR}/VTKConfig.cmake)
106
ELSE(EXISTS ${VTK_DIR}/VTKConfig.cmake)
107
IF(EXISTS ${VTK_DIR}/UseVTK.cmake)
108
# We found VTK 4.0 (UseVTK.cmake exists, but not VTKConfig.cmake).
110
# Load settings for VTK 4.0.
111
INCLUDE(${CMAKE_ROOT}/Modules/UseVTKConfig40.cmake)
112
ELSE(EXISTS ${VTK_DIR}/UseVTK.cmake)
113
# We did not find VTK.
115
ENDIF(EXISTS ${VTK_DIR}/UseVTK.cmake)
116
ENDIF(EXISTS ${VTK_DIR}/VTKConfig.cmake)
118
# We did not find VTK.
122
#-----------------------------------------------------------------------------
124
# Set USE_VTK_FILE for backward-compatability.
125
SET(USE_VTK_FILE ${VTK_USE_FILE})
127
# VTK not found, explain to the user how to specify its location.
128
IF(NOT VTK_FIND_QUIETLY)
129
MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE})
130
ELSE(NOT VTK_FIND_QUIETLY)
131
IF(VTK_FIND_REQUIRED)
132
MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE})
133
ENDIF(VTK_FIND_REQUIRED)
134
ENDIF(NOT VTK_FIND_QUIETLY)