<commit_before>CMAKE_MINIMUM_REQUIRED(VERSION 1.6)
PROJECT(VTK)
INCLUDE_REGULAR_EXPRESSION("^(lex|vtk|png|j).*$")

# Don't build anything unless the version of CMake is high enough.
# The matching ELSE/ENDIF should be the last lines in the file.
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)

#-----------------------------------------------------------------------------
# VTK version number.  An even minor number corresponds to releases.
SET(VTK_MAJOR_VERSION 4)
SET(VTK_MINOR_VERSION 1)
SET(VTK_BUILD_VERSION 1)
SET(VTK_VERSION
    "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")

#-----------------------------------------------------------------------------
# Output directories.
SET (LIBRARY_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
SET (EXECUTABLE_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
SET(VTK_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
SET(VTK_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})

#-----------------------------------------------------------------------------
# Platform configuration tests.
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)

SET(VTK_SIZEOF_CHAR   ${CMAKE_SIZEOF_CHAR})
SET(VTK_SIZEOF_DOUBLE ${CMAKE_SIZEOF_DOUBLE})
SET(VTK_SIZEOF_FLOAT  ${CMAKE_SIZEOF_FLOAT})
SET(VTK_SIZEOF_INT    ${CMAKE_SIZEOF_INT})
SET(VTK_SIZEOF_LONG   ${CMAKE_SIZEOF_LONG})
SET(VTK_SIZEOF_SHORT  ${CMAKE_SIZEOF_SHORT})

IF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")
  MESSAGE(STATUS "Checking support for C++ type bool")
  TRY_COMPILE(VTK_COMPILER_HAS_BOOL
              ${VTK_BINARY_DIR}
              ${VTK_SOURCE_DIR}/CMake/vtkTestBoolType.cxx
              OUTPUT_VARIABLE OUTPUT)
  IF(VTK_COMPILER_HAS_BOOL)
    MESSAGE(STATUS "Checking support for C++ type bool -- yes")
    SET(VTK_COMPILER_HAS_BOOL 1 CACHE INTERNAL "Support for C++ type bool")
  ELSE(VTK_COMPILER_HAS_BOOL)
    MESSAGE(STATUS "Checking support for C++ type bool -- no")
    SET(VTK_COMPILER_HAS_BOOL 1 CACHE INTERNAL "Support for C++ type bool")
    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log 
      "Determining if the C++ compiler supports type bool "
      "failed with the following output:\n"
      "${OUTPUT}\n" APPEND)
  ENDIF(VTK_COMPILER_HAS_BOOL)
ENDIF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")

#-----------------------------------------------------------------------------
# Load the VTK CMake extension module.

# Import the VTK_LOAD_CMAKE_EXTENSIONS macro.
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake)

# Compile the extensions into the build tree and load them.
VTK_LOAD_CMAKE_EXTENSIONS(${VTK_SOURCE_DIR}/CMake ${VTK_BINARY_DIR}/CMake)

# Install cmake extension directory so user projects can build the commands.
INSTALL_FILES(/lib/vtk/CMake FILES
              ${VTK_SOURCE_DIR}/CMake/CMakeLists.txt
              ${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapTcl2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapPython2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapJava2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKMakeInstantiator2Command.c)

#-----------------------------------------------------------------------------
# Determine the set of VTK kits that should be built.
OPTION (VTK_USE_RENDERING "Build the vtkRendering kit.  Needed for displaying data." ON)
OPTION (VTK_USE_HYBRID "Build the vtkHybrid kit." OFF)
OPTION (VTK_USE_PARALLEL "Build the vtkParallel kit." OFF)
OPTION (VTK_USE_PATENTED
        "Build the vtkPatented kit.  These classes are patented and may require a license to use."
        OFF)

SET(VTK_KITS COMMON FILTERING IO GRAPHICS IMAGING)
IF(VTK_USE_RENDERING)
  SET(VTK_KITS ${VTK_KITS} RENDERING)
ENDIF(VTK_USE_RENDERING)
IF(VTK_USE_HYBRID)
  SET(VTK_KITS ${VTK_KITS} HYBRID)
ENDIF(VTK_USE_HYBRID)
IF(VTK_USE_PARALLEL)
  SET(VTK_KITS ${VTK_KITS} PARALLEL)
ENDIF(VTK_USE_PARALLEL)
IF(VTK_USE_PATENTED)
  SET(VTK_KITS ${VTK_KITS} PATENTED)
ENDIF(VTK_USE_PATENTED)

#-----------------------------------------------------------------------------
# Determine the set of language wrappers that should be built.
OPTION(VTK_WRAP_TCL "Wrap VTK classes into the TCL language.")
OPTION(VTK_WRAP_PYTHON "Wrap VTK classes into the Python language.")
OPTION(VTK_WRAP_JAVA "Wrap VTK classes into the Java language.")

SET(VTK_LANGUAGES "")
IF(VTK_WRAP_TCL)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_PYTHON)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
ENDIF(VTK_WRAP_PYTHON)
IF(VTK_WRAP_JAVA)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
ENDIF(VTK_WRAP_JAVA)

#-----------------------------------------------------------------------------
# VTK requires special compiler flags on some platforms.
IF(CMAKE_COMPILER_IS_GNUCXX)
  IF(WIN32)
    # The platform is gcc on cygwin.
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32")
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32")
  ENDIF(WIN32)
ELSE(CMAKE_COMPILER_IS_GNUCXX)
  IF(CMAKE_ANSI_CFLAGS)
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
  ENDIF(CMAKE_ANSI_CFLAGS)
  IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
     SET(VTK_REQUIRED_CXX_FLAGS
         "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
  ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

IF(APPLE)
  IF (VTK_USE_CARBON)
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -fpascal-strings")
  ENDIF (VTK_USE_CARBON)
  IF(BUILD_SHARED_LIBS)
    SET(VTK_APPLE_SHARED_FLAGS_NEEDED 1)
  ENDIF(BUILD_SHARED_LIBS)
ENDIF(APPLE)

IF(VTK_USE_X)
  IF(CMAKE_X_CFLAGS)
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}")
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}")
  ENDIF(CMAKE_X_CFLAGS)
ENDIF(VTK_USE_X)

#-----------------------------------------------------------------------------
# VTK utility script locations.
SET(VTK_DOXYGEN_HOME ${VTK_SOURCE_DIR}/Utilities/Doxygen)
SET(VTK_HEADER_TESTING_PY ${VTK_SOURCE_DIR}/Common/Testing/HeaderTesting.py)
SET(VTK_FIND_STRING_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/FindString.tcl)
SET(VTK_PRINT_SELF_CHECK_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/PrintSelfCheck.tcl)
SET(VTK_RT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl)
IF(VTK_USE_PARALLEL)
  SET(VTK_PRT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/prtImageTest.tcl)
ENDIF(VTK_USE_PARALLEL)

#-----------------------------------------------------------------------------
# VTK wrapper package locations
IF(VTK_WRAP_TCL)
  SET(VTK_TCL_HOME ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_JAVA)
  SET(VTK_JAVA_JAR ${LIBRARY_OUTPUT_PATH}/vtk.jar)
ENDIF(VTK_WRAP_JAVA)

#-----------------------------------------------------------------------------
OPTION(BUILD_SHARED_LIBS "Build VTK with shared libraries." OFF)
OPTION(BUILD_EXAMPLES "Build VTK examples." OFF)
OPTION(VTK_USE_64BIT_IDS "Build VTK with 64 bit ids" OFF)
MARK_AS_ADVANCED(VTK_USE_64BIT_IDS)
SET(VTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})

SUBDIRS(Wrapping Utilities Common Filtering Imaging Graphics IO)
INSTALL_FILES(/include/vtk .h vtkCommonInstantiator vtkFilteringInstantiator 
  vtkIOInstantiator vtkImagingInstantiator vtkGraphicsInstantiator)

OPTION (VTK_DEBUG_LEAKS "Build leak checking support into vtk." OFF)
MARK_AS_ADVANCED(VTK_DEBUG_LEAKS)

SET(VTK_DEFAULT_USE_X ON)
IF (APPLE)
  OPTION (VTK_USE_COCOA 
     "Build classes using Cocoa API - Can only use one of these!" OFF)
  OPTION (VTK_USE_CARBON "Build classes using Carbon API" ON)
  IF (CMAKE_HAS_X)
    SET(VTK_DEFAULT_USE_X OFF)
  ENDIF (CMAKE_HAS_X)
ELSE(APPLE)
  IF(CYGWIN)
    SET(VTK_DEFAULT_USE_X OFF)
  ENDIF(CYGWIN)
ENDIF(APPLE)

IF(CMAKE_HAS_X)
  OPTION(VTK_USE_X "Build classes for the X11 window manager" 
         ${VTK_DEFAULT_USE_X})
ENDIF(CMAKE_HAS_X)

IF(VTK_WRAP_TCL)
  IF(VTK_USE_RENDERING)
    SET(VTK_INCLUDE_NEED_TK 1)
  ENDIF(VTK_USE_RENDERING)
ENDIF(VTK_WRAP_TCL)

IF(VTK_WRAP_PYTHON)
  IF(VTK_USE_RENDERING)
    IF(NOT VTK_WRAP_TCL)
      SET(VTK_INCLUDE_NEED_TK 1)
    ENDIF(NOT VTK_WRAP_TCL)
  ENDIF(VTK_USE_RENDERING)
ENDIF(VTK_WRAP_PYTHON)

IF(VTK_INCLUDE_NEED_TK)
  IF(WIN32)
    IF(UNIX)
      # for builds against the source tree on Cygwin
      FIND_PATH(TK_XLIB_PATH X11/Xlib.h ${TK_INCLUDE_PATH} 
                ${TK_INCLUDE_PATH}/../xlib)
      MARK_AS_ADVANCED(TK_XLIB_PATH)
    ENDIF(UNIX)
  ENDIF(WIN32)
ENDIF(VTK_INCLUDE_NEED_TK)

IF (VTK_USE_PARALLEL)
    OPTION (VTK_USE_MPI 
      "use MPI (Message Passing Interface) library for parallel support")
    MARK_AS_ADVANCED(VTK_USE_MPI)
    IF(BUILD_TESTING)
      IF (VTK_USE_MPI)
        FIND_PROGRAM(VTK_MPIRUN_EXE NAMES mpirun lamexec)
        MARK_AS_ADVANCED(VTK_MPIRUN_EXE)
        SET (VTK_MPI_PREFLAGS "-np 2" CACHE STRING " Flags used by mpi start program.")
        SET (VTK_MPI_POSTFLAGS "" CACHE STRING "Flags used by mpi start program.")
        SET (VTK_MPI_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run parallel applications.")
        MARK_AS_ADVANCED(VTK_MPI_PREFLAGS VTK_MPI_POSTFLAGS VTK_MPI_MAX_NUMPROCS)
        SEPARATE_ARGUMENTS(VTK_MPI_PREFLAGS)
        SEPARATE_ARGUMENTS(VTK_MPI_POSTFLAGS)
      ENDIF (VTK_USE_MPI)
    ENDIF(BUILD_TESTING)
ENDIF (VTK_USE_PARALLEL)

OPTION (VTK_USE_MANGLED_MESA "Use mangled Mesa with OpenGL" OFF)
MARK_AS_ADVANCED(VTK_USE_MANGLED_MESA)
IF (VTK_USE_MANGLED_MESA)
  FIND_PATH(MANGLED_MESA_INCLUDE_DIR GL/gl_mangle.h )
  FIND_LIBRARY(MANGLED_MESA_LIBRARY MesaGL)
  IF(MANGLED_MESA_INCLUDE_DIR)
    USE_MANGLED_MESA(${MANGLED_MESA_INCLUDE_DIR}/GL
                     ${VTK_BINARY_DIR}/MangleMesaInclude)
  ENDIF(MANGLED_MESA_INCLUDE_DIR)
ENDIF(VTK_USE_MANGLED_MESA)

#-----------------------------------------------------------------------------
# Provide options to use system versions of third-party libraries.
INCLUDE("${VTK_SOURCE_DIR}/vtkThirdParty.cmake")
VTK_THIRD_PARTY_OPTION(ZLIB zlib)
VTK_THIRD_PARTY_OPTION(JPEG jpeg)
VTK_THIRD_PARTY_OPTION(PNG  png)
VTK_THIRD_PARTY_OPTION(TIFF tiff)
VTK_THIRD_PARTY_OPTION(EXPAT expat)
#-----------------------------------------------------------------------------

IF (VTK_WRAP_TCL)
  INCLUDE (${CMAKE_ROOT}/Modules/FindTCL.cmake)
  UTILITY_SOURCE(VTK_WRAP_TCL_EXE vtkWrapTcl Wrapping vtkWrapTcl.c)
  MARK_AS_ADVANCED(VTK_WRAP_TCL_EXE)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping )
  MARK_AS_ADVANCED(VTK_WRAP_HINTS)
  SET (VTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/vtk)
  IF(VTK_USE_PARALLEL)
    IF(VTK_USE_MPI)
      SET (PVTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/pvtk)
    ENDIF(VTK_USE_MPI)
  ENDIF(VTK_USE_PARALLEL)
ENDIF (VTK_WRAP_TCL)

SET(VTK_RENDERING_NEED_TK_INTERNAL 0)
IF(VTK_USE_RENDERING)
  IF (VTK_WRAP_TCL)
    SET(VTK_RENDERING_NEED_TK_INTERNAL 1)
  ENDIF (VTK_WRAP_TCL)
  IF (VTK_WRAP_PYTHON)
    SET(VTK_RENDERING_NEED_TK_INTERNAL 1)
  ENDIF (VTK_WRAP_PYTHON)
  IF (VTK_DISABLE_TK_INIT)
    SET(VTK_RENDERING_NEED_TK_INTERNAL 0)
  ENDIF (VTK_DISABLE_TK_INIT)

  IF(VTK_RENDERING_NEED_TK_INTERNAL)
    IF (TK_LIBRARY)
      IF (APPLE)
        FIND_PATH(TK_INTERNAL_PATH tkMacOSXInt.h
          ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk84OSX)
      ELSE(APPLE)
        IF (TK_LIBRARY MATCHES tk82)
          FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
            ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk82)
        ENDIF (TK_LIBRARY MATCHES tk82)
        IF (TK_LIBRARY MATCHES tk83)
          FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
            ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk83)
        ENDIF (TK_LIBRARY MATCHES tk83)
        IF (TK_LIBRARY MATCHES tk84)
          FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
            ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk84)
        ENDIF (TK_LIBRARY MATCHES tk84)
      ENDIF (APPLE)
    ENDIF (TK_LIBRARY)
  ENDIF(VTK_RENDERING_NEED_TK_INTERNAL)
ENDIF(VTK_USE_RENDERING)

IF (VTK_WRAP_PYTHON)
  INCLUDE (${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping )
  MARK_AS_ADVANCED(VTK_WRAP_HINTS)
  UTILITY_SOURCE(VTK_WRAP_PYTHON_EXE vtkWrapPython Wrapping vtkWrapPython.c)
  MARK_AS_ADVANCED(VTK_WRAP_PYTHON_EXE)
  IF (NOT VTK_BUILD_SHARED_LIBS)
    MESSAGE(SEND_ERROR "Python support requires BUILD_SHARED_LIBS to be on.")
    SET(VTK_WRAP_PYTHON 0)
  ENDIF (NOT VTK_BUILD_SHARED_LIBS)  
  IF (NOT PYTHON_DEBUG_LIBRARY)
    SET(PYTHON_DEBUG_LIBRARY ${PYTHON_LIBRARY})
    IF(WIN32)
      MESSAGE("Cannot find Python debug library. The regular Python library will be used. This means that when using debug build of VTK, python examples might not run. If you use release build or you do not care about python working, set PYTHON_DEBUG_LIBRARY to the same file as PYTHON_LIBRARY.")
    ENDIF(WIN32)
  ENDIF (NOT PYTHON_DEBUG_LIBRARY)
  SET(VTK_PYTHON_EXE ${VTK_EXECUTABLE_PATH}/vtkpython)
  SET(PVTK_PYTHON_EXE ${VTK_EXECUTABLE_PATH}/pvtkpython)
ENDIF (VTK_WRAP_PYTHON)

# python executable is used by some tests whether VTK_WRAP_PYTHON is
# on or not.  do not add a VTK_WRAP_PYTHON to this if.
SET(VTK_NEED_PYTHON_EXECUTABLE 0)
IF(BUILD_TESTING)
 IF (DART_ROOT)
   SET(VTK_NEED_PYTHON_EXECUTABLE 1)
 ENDIF (DART_ROOT)
ENDIF(BUILD_TESTING)

# If VTK_WRAP_PYTHON is on, then we need python executable to compile
# scripts.
IF(VTK_WRAP_PYTHON)
  SET(VTK_NEED_PYTHON_EXECUTABLE 1)
ENDIF(VTK_WRAP_PYTHON)

IF(VTK_NEED_PYTHON_EXECUTABLE)
  FIND_PROGRAM(PYTHON_EXECUTABLE
    NAMES python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python<commit_msg>Find vtkpython and pvtkpython in the right place<commit_after>CMAKE_MINIMUM_REQUIRED(VERSION 1.6)
PROJECT(VTK)
INCLUDE_REGULAR_EXPRESSION("^(lex|vtk|png|j).*$")

# Don't build anything unless the version of CMake is high enough.
# The matching ELSE/ENDIF should be the last lines in the file.
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)

#-----------------------------------------------------------------------------
# VTK version number.  An even minor number corresponds to releases.
SET(VTK_MAJOR_VERSION 4)
SET(VTK_MINOR_VERSION 1)
SET(VTK_BUILD_VERSION 1)
SET(VTK_VERSION
    "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")

#-----------------------------------------------------------------------------
# Output directories.
SET (LIBRARY_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
SET (EXECUTABLE_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
SET(VTK_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
SET(VTK_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})

#-----------------------------------------------------------------------------
# Platform configuration tests.
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)

SET(VTK_SIZEOF_CHAR   ${CMAKE_SIZEOF_CHAR})
SET(VTK_SIZEOF_DOUBLE ${CMAKE_SIZEOF_DOUBLE})
SET(VTK_SIZEOF_FLOAT  ${CMAKE_SIZEOF_FLOAT})
SET(VTK_SIZEOF_INT    ${CMAKE_SIZEOF_INT})
SET(VTK_SIZEOF_LONG   ${CMAKE_SIZEOF_LONG})
SET(VTK_SIZEOF_SHORT  ${CMAKE_SIZEOF_SHORT})

IF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")
  MESSAGE(STATUS "Checking support for C++ type bool")
  TRY_COMPILE(VTK_COMPILER_HAS_BOOL
              ${VTK_BINARY_DIR}
              ${VTK_SOURCE_DIR}/CMake/vtkTestBoolType.cxx
              OUTPUT_VARIABLE OUTPUT)
  IF(VTK_COMPILER_HAS_BOOL)
    MESSAGE(STATUS "Checking support for C++ type bool -- yes")
    SET(VTK_COMPILER_HAS_BOOL 1 CACHE INTERNAL "Support for C++ type bool")
  ELSE(VTK_COMPILER_HAS_BOOL)
    MESSAGE(STATUS "Checking support for C++ type bool -- no")
    SET(VTK_COMPILER_HAS_BOOL 1 CACHE INTERNAL "Support for C++ type bool")
    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log 
      "Determining if the C++ compiler supports type bool "
      "failed with the following output:\n"
      "${OUTPUT}\n" APPEND)
  ENDIF(VTK_COMPILER_HAS_BOOL)
ENDIF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")

#-----------------------------------------------------------------------------
# Load the VTK CMake extension module.

# Import the VTK_LOAD_CMAKE_EXTENSIONS macro.
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake)

# Compile the extensions into the build tree and load them.
VTK_LOAD_CMAKE_EXTENSIONS(${VTK_SOURCE_DIR}/CMake ${VTK_BINARY_DIR}/CMake)

# Install cmake extension directory so user projects can build the commands.
INSTALL_FILES(/lib/vtk/CMake FILES
              ${VTK_SOURCE_DIR}/CMake/CMakeLists.txt
              ${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapTcl2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapPython2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapJava2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKMakeInstantiator2Command.c)

#-----------------------------------------------------------------------------
# Determine the set of VTK kits that should be built.
OPTION (VTK_USE_RENDERING "Build the vtkRendering kit.  Needed for displaying data." ON)
OPTION (VTK_USE_HYBRID "Build the vtkHybrid kit." OFF)
OPTION (VTK_USE_PARALLEL "Build the vtkParallel kit." OFF)
OPTION (VTK_USE_PATENTED
        "Build the vtkPatented kit.  These classes are patented and may require a license to use."
        OFF)

SET(VTK_KITS COMMON FILTERING IO GRAPHICS IMAGING)
IF(VTK_USE_RENDERING)
  SET(VTK_KITS ${VTK_KITS} RENDERING)
ENDIF(VTK_USE_RENDERING)
IF(VTK_USE_HYBRID)
  SET(VTK_KITS ${VTK_KITS} HYBRID)
ENDIF(VTK_USE_HYBRID)
IF(VTK_USE_PARALLEL)
  SET(VTK_KITS ${VTK_KITS} PARALLEL)
ENDIF(VTK_USE_PARALLEL)
IF(VTK_USE_PATENTED)
  SET(VTK_KITS ${VTK_KITS} PATENTED)
ENDIF(VTK_USE_PATENTED)

#-----------------------------------------------------------------------------
# Determine the set of language wrappers that should be built.
OPTION(VTK_WRAP_TCL "Wrap VTK classes into the TCL language.")
OPTION(VTK_WRAP_PYTHON "Wrap VTK classes into the Python language.")
OPTION(VTK_WRAP_JAVA "Wrap VTK classes into the Java language.")

SET(VTK_LANGUAGES "")
IF(VTK_WRAP_TCL)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_PYTHON)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
ENDIF(VTK_WRAP_PYTHON)
IF(VTK_WRAP_JAVA)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
ENDIF(VTK_WRAP_JAVA)

#-----------------------------------------------------------------------------
# VTK requires special compiler flags on some platforms.
IF(CMAKE_COMPILER_IS_GNUCXX)
  IF(WIN32)
    # The platform is gcc on cygwin.
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32")
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32")
  ENDIF(WIN32)
ELSE(CMAKE_COMPILER_IS_GNUCXX)
  IF(CMAKE_ANSI_CFLAGS)
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
  ENDIF(CMAKE_ANSI_CFLAGS)
  IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
     SET(VTK_REQUIRED_CXX_FLAGS
         "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
  ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

IF(APPLE)
  IF (VTK_USE_CARBON)
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -fpascal-strings")
  ENDIF (VTK_USE_CARBON)
  IF(BUILD_SHARED_LIBS)
    SET(VTK_APPLE_SHARED_FLAGS_NEEDED 1)
  ENDIF(BUILD_SHARED_LIBS)
ENDIF(APPLE)

IF(VTK_USE_X)
  IF(CMAKE_X_CFLAGS)
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}")
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}")
  ENDIF(CMAKE_X_CFLAGS)
ENDIF(VTK_USE_X)

#-----------------------------------------------------------------------------
# VTK utility script locations.
SET(VTK_DOXYGEN_HOME ${VTK_SOURCE_DIR}/Utilities/Doxygen)
SET(VTK_HEADER_TESTING_PY ${VTK_SOURCE_DIR}/Common/Testing/HeaderTesting.py)
SET(VTK_FIND_STRING_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/FindString.tcl)
SET(VTK_PRINT_SELF_CHECK_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/PrintSelfCheck.tcl)
SET(VTK_RT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl)
IF(VTK_USE_PARALLEL)
  SET(VTK_PRT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/prtImageTest.tcl)
ENDIF(VTK_USE_PARALLEL)

#-----------------------------------------------------------------------------
# VTK wrapper package locations
IF(VTK_WRAP_TCL)
  SET(VTK_TCL_HOME ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_JAVA)
  SET(VTK_JAVA_JAR ${LIBRARY_OUTPUT_PATH}/vtk.jar)
ENDIF(VTK_WRAP_JAVA)

#-----------------------------------------------------------------------------
OPTION(BUILD_SHARED_LIBS "Build VTK with shared libraries." OFF)
OPTION(BUILD_EXAMPLES "Build VTK examples." OFF)
OPTION(VTK_USE_64BIT_IDS "Build VTK with 64 bit ids" OFF)
MARK_AS_ADVANCED(VTK_USE_64BIT_IDS)
SET(VTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})

SUBDIRS(Wrapping Utilities Common Filtering Imaging Graphics IO)
INSTALL_FILES(/include/vtk .h vtkCommonInstantiator vtkFilteringInstantiator 
  vtkIOInstantiator vtkImagingInstantiator vtkGraphicsInstantiator)

OPTION (VTK_DEBUG_LEAKS "Build leak checking support into vtk." OFF)
MARK_AS_ADVANCED(VTK_DEBUG_LEAKS)

SET(VTK_DEFAULT_USE_X ON)
IF (APPLE)
  OPTION (VTK_USE_COCOA 
     "Build classes using Cocoa API - Can only use one of these!" OFF)
  OPTION (VTK_USE_CARBON "Build classes using Carbon API" ON)
  IF (CMAKE_HAS_X)
    SET(VTK_DEFAULT_USE_X OFF)
  ENDIF (CMAKE_HAS_X)
ELSE(APPLE)
  IF(CYGWIN)
    SET(VTK_DEFAULT_USE_X OFF)
  ENDIF(CYGWIN)
ENDIF(APPLE)

IF(CMAKE_HAS_X)
  OPTION(VTK_USE_X "Build classes for the X11 window manager" 
         ${VTK_DEFAULT_USE_X})
ENDIF(CMAKE_HAS_X)

IF(VTK_WRAP_TCL)
  IF(VTK_USE_RENDERING)
    SET(VTK_INCLUDE_NEED_TK 1)
  ENDIF(VTK_USE_RENDERING)
ENDIF(VTK_WRAP_TCL)

IF(VTK_WRAP_PYTHON)
  IF(VTK_USE_RENDERING)
    IF(NOT VTK_WRAP_TCL)
      SET(VTK_INCLUDE_NEED_TK 1)
    ENDIF(NOT VTK_WRAP_TCL)
  ENDIF(VTK_USE_RENDERING)
ENDIF(VTK_WRAP_PYTHON)

IF(VTK_INCLUDE_NEED_TK)
  IF(WIN32)
    IF(UNIX)
      # for builds against the source tree on Cygwin
      FIND_PATH(TK_XLIB_PATH X11/Xlib.h ${TK_INCLUDE_PATH} 
                ${TK_INCLUDE_PATH}/../xlib)
      MARK_AS_ADVANCED(TK_XLIB_PATH)
    ENDIF(UNIX)
  ENDIF(WIN32)
ENDIF(VTK_INCLUDE_NEED_TK)

IF (VTK_USE_PARALLEL)
    OPTION (VTK_USE_MPI 
      "use MPI (Message Passing Interface) library for parallel support")
    MARK_AS_ADVANCED(VTK_USE_MPI)
    IF(BUILD_TESTING)
      IF (VTK_USE_MPI)
        FIND_PROGRAM(VTK_MPIRUN_EXE NAMES mpirun lamexec)
        MARK_AS_ADVANCED(VTK_MPIRUN_EXE)
        SET (VTK_MPI_PREFLAGS "-np 2" CACHE STRING " Flags used by mpi start program.")
        SET (VTK_MPI_POSTFLAGS "" CACHE STRING "Flags used by mpi start program.")
        SET (VTK_MPI_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run parallel applications.")
        MARK_AS_ADVANCED(VTK_MPI_PREFLAGS VTK_MPI_POSTFLAGS VTK_MPI_MAX_NUMPROCS)
        SEPARATE_ARGUMENTS(VTK_MPI_PREFLAGS)
        SEPARATE_ARGUMENTS(VTK_MPI_POSTFLAGS)
      ENDIF (VTK_USE_MPI)
    ENDIF(BUILD_TESTING)
ENDIF (VTK_USE_PARALLEL)

OPTION (VTK_USE_MANGLED_MESA "Use mangled Mesa with OpenGL" OFF)
MARK_AS_ADVANCED(VTK_USE_MANGLED_MESA)
IF (VTK_USE_MANGLED_MESA)
  FIND_PATH(MANGLED_MESA_INCLUDE_DIR GL/gl_mangle.h )
  FIND_LIBRARY(MANGLED_MESA_LIBRARY MesaGL)
  IF(MANGLED_MESA_INCLUDE_DIR)
    USE_MANGLED_MESA(${MANGLED_MESA_INCLUDE_DIR}/GL
                     ${VTK_BINARY_DIR}/MangleMesaInclude)
  ENDIF(MANGLED_MESA_INCLUDE_DIR)
ENDIF(VTK_USE_MANGLED_MESA)

#-----------------------------------------------------------------------------
# Provide options to use system versions of third-party libraries.
INCLUDE("${VTK_SOURCE_DIR}/vtkThirdParty.cmake")
VTK_THIRD_PARTY_OPTION(ZLIB zlib)
VTK_THIRD_PARTY_OPTION(JPEG jpeg)
VTK_THIRD_PARTY_OPTION(PNG  png)
VTK_THIRD_PARTY_OPTION(TIFF tiff)
VTK_THIRD_PARTY_OPTION(EXPAT expat)
#-----------------------------------------------------------------------------

IF (VTK_WRAP_TCL)
  INCLUDE (${CMAKE_ROOT}/Modules/FindTCL.cmake)
  UTILITY_SOURCE(VTK_WRAP_TCL_EXE vtkWrapTcl Wrapping vtkWrapTcl.c)
  MARK_AS_ADVANCED(VTK_WRAP_TCL_EXE)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping )
  MARK_AS_ADVANCED(VTK_WRAP_HINTS)
  SET (VTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/vtk)
  IF(VTK_USE_PARALLEL)
    IF(VTK_USE_MPI)
      SET (PVTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/pvtk)
    ENDIF(VTK_USE_MPI)
  ENDIF(VTK_USE_PARALLEL)
ENDIF (VTK_WRAP_TCL)

SET(VTK_RENDERING_NEED_TK_INTERNAL 0)
IF(VTK_USE_RENDERING)
  IF (VTK_WRAP_TCL)
    SET(VTK_RENDERING_NEED_TK_INTERNAL 1)
  ENDIF (VTK_WRAP_TCL)
  IF (VTK_WRAP_PYTHON)
    SET(VTK_RENDERING_NEED_TK_INTERNAL 1)
  ENDIF (VTK_WRAP_PYTHON)
  IF (VTK_DISABLE_TK_INIT)
    SET(VTK_RENDERING_NEED_TK_INTERNAL 0)
  ENDIF (VTK_DISABLE_TK_INIT)

  IF(VTK_RENDERING_NEED_TK_INTERNAL)
    IF (TK_LIBRARY)
      IF (APPLE)
        FIND_PATH(TK_INTERNAL_PATH tkMacOSXInt.h
          ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk84OSX)
      ELSE(APPLE)
        IF (TK_LIBRARY MATCHES tk82)
          FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
            ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk82)
        ENDIF (TK_LIBRARY MATCHES tk82)
        IF (TK_LIBRARY MATCHES tk83)
          FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
            ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk83)
        ENDIF (TK_LIBRARY MATCHES tk83)
        IF (TK_LIBRARY MATCHES tk84)
          FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
            ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk84)
        ENDIF (TK_LIBRARY MATCHES tk84)
      ENDIF (APPLE)
    ENDIF (TK_LIBRARY)
  ENDIF(VTK_RENDERING_NEED_TK_INTERNAL)
ENDIF(VTK_USE_RENDERING)

IF (VTK_WRAP_PYTHON)
  INCLUDE (${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping )
  MARK_AS_ADVANCED(VTK_WRAP_HINTS)
  UTILITY_SOURCE(VTK_WRAP_PYTHON_EXE vtkWrapPython Wrapping vtkWrapPython.c)
  MARK_AS_ADVANCED(VTK_WRAP_PYTHON_EXE)
  IF (NOT VTK_BUILD_SHARED_LIBS)
    MESSAGE(SEND_ERROR "Python support requires BUILD_SHARED_LIBS to be on.")
    SET(VTK_WRAP_PYTHON 0)
  ENDIF (NOT VTK_BUILD_SHARED_LIBS)  
  IF (NOT PYTHON_DEBUG_LIBRARY)
    SET(PYTHON_DEBUG_LIBRARY ${PYTHON_LIBRARY})
    IF(WIN32)
      MESSAGE("Cannot find Python debug library. The regular Python library will be used. This means that when using debug build of VTK, python examples might not run. If you use release build or you do not care about python working, set PYTHON_DEBUG_LIBRARY to the same file as PYTHON_LIBRARY.")
    ENDIF(WIN32)
  ENDIF (NOT PYTHON_DEBUG_LIBRARY)
  SET(VTK_PYTHON_EXE ${EXECUTABLE_OUTPUT_PATH}/vtkpython)
  SET(PVTK_PYTHON_EXE ${EXECUTABLE_OUTPUT_PATH}/pvtkpython)
ENDIF (VTK_WRAP_PYTHON)

# python executable is used by some tests whether VTK_WRAP_PYTHON is
# on or not.  do not add a VTK_WRAP_PYTHON to this if.
SET(VTK_NEED_PYTHON_EXECUTABLE 0)
IF(BUILD_TESTING)
 IF (DART_ROOT)
   SET(VTK_NEED_PYTHON_EXECUTABLE 1)
 ENDIF (DART_ROOT)
ENDIF(BUILD_TESTING)

# If VTK_WRAP_PYTHON is on, then we need python executable to compile
# scripts.
IF(VTK_WRAP_PYTHON)
  SET(VTK_NEED_PYTHON_EXECUTABLE 1)
ENDIF(VTK_WRAP_PYTHON)

IF(VTK_NEED_PYTHON_EXECUTABLE)
  FIND_PROGRAM(PYTHON_EXECUTABLE
    NAMES python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
{'fraction_non_alphanumeric': 0.1468082792619712, 'fraction_numerical': 0.006234820748903469, 'mean_word_length': 3.6998296422487225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3895163', 'n_tokens_mistral': 11589, 'n_tokens_neox': 10954, 'n_words': 1836}