2005-12-14 21:51:08 +03:00
# - Find a VTK installation or build tree.
2002-12-05 18:47:18 +03:00
# The following variables are set if VTK is found. If VTK is not
# found, VTK_FOUND is set to false.
2005-12-15 22:17:43 +03:00
# VTK_FOUND - Set to true when VTK is found.
# VTK_USE_FILE - CMake file to use VTK.
# VTK_MAJOR_VERSION - The VTK major version number.
# VTK_MINOR_VERSION - The VTK minor version number
2005-12-14 21:51:08 +03:00
# (odd non-release).
2005-12-15 22:17:43 +03:00
# VTK_BUILD_VERSION - The VTK patch level
2005-12-14 21:51:08 +03:00
# (meaningless for odd minor).
2005-12-15 22:17:43 +03:00
# VTK_INCLUDE_DIRS - Include directories for VTK
# VTK_LIBRARY_DIRS - Link directories for VTK libraries
# VTK_KITS - List of VTK kits, in CAPS
# (COMMON,IO,) etc.
# VTK_LANGUAGES - List of wrapped languages, in CAPS
# (TCL, PYHTON,) etc.
2002-12-05 18:47:18 +03:00
# The following cache entries must be set by the user to locate VTK:
2005-12-15 22:17:43 +03:00
# VTK_DIR - The directory containing VTKConfig.cmake.
# This is either the root of the build tree,
# or the lib/vtk directory. This is the
# only cache entry.
2005-12-14 21:51:08 +03:00
# The following variables are set for backward compatibility and
2002-12-05 18:47:18 +03:00
# should not be used in new code:
2005-12-15 22:17:43 +03:00
# USE_VTK_FILE - The full path to the UseVTK.cmake file.
# This is provided for backward
# compatibility. Use VTK_USE_FILE
# instead.
2001-09-19 22:52:59 +04:00
#
2001-12-21 22:40:33 +03:00
2009-10-02 01:21:28 +04:00
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
2002-11-20 21:37:52 +03:00
# Construct consitent error messages for use below.
2002-11-21 00:23:20 +03:00
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." )
2003-07-24 19:06:18 +04:00
SET ( VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}" )
2002-01-08 01:29:06 +03:00
2002-11-20 21:37:52 +03:00
# Search only if the location is not already known.
IF ( NOT VTK_DIR )
# Get the system search path as a list.
IF ( UNIX )
2003-01-18 02:14:40 +03:00
STRING ( REGEX MATCHALL "[^:]+" VTK_DIR_SEARCH1 "$ENV{PATH}" )
2002-11-20 21:37:52 +03:00
ELSE ( UNIX )
2003-01-18 02:14:40 +03:00
STRING ( REGEX REPLACE "\\\\" "/" VTK_DIR_SEARCH1 "$ENV{PATH}" )
2002-11-20 21:37:52 +03:00
ENDIF ( UNIX )
2003-01-18 02:14:40 +03:00
STRING ( REGEX REPLACE "/;" ";" VTK_DIR_SEARCH2 "${VTK_DIR_SEARCH1}" )
2001-09-21 01:31:38 +04:00
2002-11-20 21:37:52 +03:00
# Construct a set of paths relative to the system search path.
SET ( VTK_DIR_SEARCH "" )
FOREACH ( dir ${ VTK_DIR_SEARCH2 } )
2006-05-23 18:40:40 +04:00
SET ( VTK_DIR_SEARCH ${ VTK_DIR_SEARCH }
2009-04-01 00:15:55 +04:00
$ { d i r } / . . / l i b / v t k - 5 . 4
2006-05-23 18:40:40 +04:00
$ { d i r } / . . / l i b / v t k - 5 . 2
$ { d i r } / . . / l i b / v t k - 5 . 1
$ { d i r } / . . / l i b / v t k - 5 . 0
$ { d i r } / . . / l i b / v t k
)
2002-11-20 21:37:52 +03:00
ENDFOREACH ( dir )
2001-05-23 19:34:19 +04:00
2002-11-20 21:37:52 +03:00
# Old scripts may set these directories in the CMakeCache.txt file.
# They can tell us where to find VTKConfig.cmake.
SET ( VTK_DIR_SEARCH_LEGACY "" )
2002-11-20 22:11:07 +03:00
IF ( VTK_BINARY_PATH AND USE_BUILT_VTK )
2002-11-20 21:37:52 +03:00
SET ( VTK_DIR_SEARCH_LEGACY ${ VTK_DIR_SEARCH_LEGACY } ${ VTK_BINARY_PATH } )
2002-11-20 22:11:07 +03:00
ENDIF ( VTK_BINARY_PATH AND USE_BUILT_VTK )
IF ( VTK_INSTALL_PATH AND USE_INSTALLED_VTK )
2002-11-20 21:37:52 +03:00
SET ( VTK_DIR_SEARCH_LEGACY ${ VTK_DIR_SEARCH_LEGACY }
$ { V T K _ I N S T A L L _ P A T H } / l i b / v t k )
2002-11-20 22:11:07 +03:00
ENDIF ( VTK_INSTALL_PATH AND USE_INSTALLED_VTK )
2001-05-23 19:34:19 +04:00
2002-11-20 21:37:52 +03:00
#
# Look for an installation or build tree.
#
2002-11-21 00:23:20 +03:00
FIND_PATH ( VTK_DIR UseVTK.cmake
2002-11-20 21:37:52 +03:00
# Support legacy cache files.
$ { V T K _ D I R _ S E A R C H _ L E G A C Y }
2002-01-08 01:29:06 +03:00
2004-04-26 19:00:41 +04:00
# Look for an environment variable VTK_DIR.
$ E N V { V T K _ D I R }
2002-11-20 21:37:52 +03:00
# Look in places relative to the system executable search path.
$ { V T K _ D I R _ S E A R C H }
# Look in standard UNIX install locations.
/ u s r / l o c a l / l i b / v t k
/ u s r / l i b / v t k
# Read from the CMakeSetup registry entries. It is likely that
# VTK will have been recently built.
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 1 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 2 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 3 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 4 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 5 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 6 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 7 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 8 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 9 ]
[ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ K i t w a r e \ \ C M a k e S e t u p \ \ S e t t i n g s \ \ S t a r t P a t h ; W h e r e B u i l d 1 0 ]
# Help the user find it if we cannot.
D O C " T h e $ { V T K _ D I R _ D E S C R I P T I O N } "
)
ENDIF ( NOT VTK_DIR )
# If VTK was found, load the configuration file to get the rest of the
# settings.
IF ( VTK_DIR )
# Make sure the VTKConfig.cmake file exists in the directory provided.
IF ( EXISTS ${ VTK_DIR } /VTKConfig.cmake )
# We found VTK. Load the settings.
SET ( VTK_FOUND 1 )
INCLUDE ( ${ VTK_DIR } /VTKConfig.cmake )
ELSE ( EXISTS ${ VTK_DIR } /VTKConfig.cmake )
2002-11-21 00:23:20 +03:00
IF ( EXISTS ${ VTK_DIR } /UseVTK.cmake )
# We found VTK 4.0 (UseVTK.cmake exists, but not VTKConfig.cmake).
SET ( VTK_FOUND 1 )
2002-12-05 18:47:18 +03:00
# Load settings for VTK 4.0.
2004-08-27 06:52:53 +04:00
INCLUDE ( UseVTKConfig40 )
2002-11-21 00:23:20 +03:00
ELSE ( EXISTS ${ VTK_DIR } /UseVTK.cmake )
# We did not find VTK.
SET ( VTK_FOUND 0 )
ENDIF ( EXISTS ${ VTK_DIR } /UseVTK.cmake )
2002-11-20 21:37:52 +03:00
ENDIF ( EXISTS ${ VTK_DIR } /VTKConfig.cmake )
ELSE ( VTK_DIR )
# We did not find VTK.
SET ( VTK_FOUND 0 )
ENDIF ( VTK_DIR )
2002-12-05 18:47:18 +03:00
#-----------------------------------------------------------------------------
2002-11-21 00:23:20 +03:00
IF ( VTK_FOUND )
# Set USE_VTK_FILE for backward-compatability.
SET ( USE_VTK_FILE ${ VTK_USE_FILE } )
ELSE ( VTK_FOUND )
# VTK not found, explain to the user how to specify its location.
2008-04-27 15:35:21 +04:00
IF ( VTK_FIND_REQUIRED )
2003-06-06 17:58:02 +04:00
MESSAGE ( FATAL_ERROR ${ VTK_DIR_MESSAGE } )
2008-04-27 15:35:21 +04:00
ELSE ( VTK_FIND_REQUIRED )
IF ( NOT VTK_FIND_QUIETLY )
MESSAGE ( STATUS ${ VTK_DIR_MESSAGE } )
ENDIF ( NOT VTK_FIND_QUIETLY )
ENDIF ( VTK_FIND_REQUIRED )
2002-11-21 00:23:20 +03:00
ENDIF ( VTK_FOUND )