CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)

FOREACH(policy CMP0012 CMP0013 CMP0014)
  IF(POLICY ${policy})
    CMAKE_POLICY(SET ${policy} NEW)
  ENDIF()
ENDFOREACH()

PROJECT(ParaView)

IF(CMAKE_CROSSCOMPILING)
  FIND_PACKAGE(ParaView3CompileTools REQUIRED)
ENDIF(CMAKE_CROSSCOMPILING)

SET(EXPORT_EXECUTABLES_FILE "${CMAKE_BINARY_DIR}/ParaView3CompileToolsConfig.cmake")
SET(EXPORT_EXECUTABLES_NAMESPACE "")
FILE(WRITE "${EXPORT_EXECUTABLES_FILE}" "#generated by Paraview, do not edit\n")
ADD_CUSTOM_TARGET(pvHostTools)
SET(COMPILE_TOOLS_TARGET pvHostTools)

GET_PROPERTY(PV_TARGET_SUPPORTS_SHARED_LIBS
  GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)

#########################################################################
# PARAVIEW_PLUGINLIST is used to generate the config file distributed with
# ParaView that lists the plugins distributed with ParaView.
SET(PARAVIEW_PLUGINLIST "" CACHE INTERNAL "List of configured plugins" FORCE)

#########################################################################
# Warn about ParaQ
SET(PARAVIEW_WARN_ABOUT_PARAQ)
IF(EXISTS "${ParaView_SOURCE_DIR}/CVS/Root")
  FILE(READ "${ParaView_SOURCE_DIR}/CVS/Root" paraview_cvs_root)
  IF("${paraview_cvs_root}" MATCHES ParaQ)
    SET(PARAVIEW_WARN_ABOUT_PARAQ 1)
  ENDIF("${paraview_cvs_root}" MATCHES ParaQ)
ENDIF(EXISTS "${ParaView_SOURCE_DIR}/CVS/Root")
IF("${ParaView_SOURCE_DIR}" MATCHES "ParaQ")
  SET(PARAVIEW_WARN_ABOUT_PARAQ 1)
ENDIF("${ParaView_SOURCE_DIR}" MATCHES "ParaQ")
IF(PARAVIEW_WARN_ABOUT_PARAQ)
  MESSAGE(SEND_ERROR "ParaView 3 should be checked out from ParaView3 repository. ParaQ repository is deprecated and will be removed")
ENDIF(PARAVIEW_WARN_ABOUT_PARAQ)

#########################################################################
# Disallow in-source build
IF("${ParaView_SOURCE_DIR}"  STREQUAL "${ParaView_BINARY_DIR}")
  MESSAGE(FATAL_ERROR "ParaView requires an out of source Build. Please create a separate binary directory and run CMake there.")
ENDIF("${ParaView_SOURCE_DIR}"  STREQUAL "${ParaView_BINARY_DIR}")

#########################################################################
SET(PARAVIEW_VERSION_MAJOR 3)
SET(PARAVIEW_VERSION_MINOR 10)
SET(PARAVIEW_VERSION_PATCH 1)
#SET(PARAVIEW_VERSION_RC 1)
SET(PARAVIEW_VERSION "${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}")
SET(PARAVIEW_VERSION_FULL "${PARAVIEW_VERSION}.${PARAVIEW_VERSION_PATCH}")
IF(PARAVIEW_VERSION_RC)
  SET(PARAVIEW_VERSION_FULL "${PARAVIEW_VERSION}.${PARAVIEW_VERSION_PATCH}-RC${PARAVIEW_VERSION_RC}")
ENDIF()

# See VTK/CMakeLists.txt for an explanation of this default selection.
IF(PARAVIEW_VERSION_MINOR MATCHES "[02468]$")
  # This is a release version.  Default to not use rpath.
  SET(VTK_USE_RPATH_DEFAULT OFF)
ELSE(PARAVIEW_VERSION_MINOR MATCHES "[02468]$")
  # This is a development version.  Default to use rpath.
  SET(VTK_USE_RPATH_DEFAULT ON)
ENDIF(PARAVIEW_VERSION_MINOR MATCHES "[02468]$")

#########################################################################
# build VTK/Qt support
OPTION(PARAVIEW_BUILD_QT_GUI "Build ParaView Qt Client. This requires Qt." ON)
IF (PARAVIEW_BUILD_QT_GUI)
  # need to set up Qt stuff here because there are Qt dependencies before
  # CMake traverses the Qt directory (VTK/GUISupport/Qt).
  
  # set vars to build the QVTK library
  SET(VTK_USE_GUISUPPORT ON CACHE BOOL "Build VTK with GUI Support" FORCE)
  SET(VTK_USE_QT ON CACHE BOOL "Build VTK with Qt Support" FORCE)
  # ParaView requires this minimum version of Qt, and let's do it here before
  # our first call to FindQt4.cmake
  SET(QT_MIN_VERSION "4.6.0")
  SET(QT_OFFICIAL_VERSION "4.6")
  SET(QT_REQUIRED TRUE)
  FIND_PACKAGE(Qt4)
  IF(NOT QT4_FOUND)
    MESSAGE(SEND_ERROR "Qt ${QT_MIN_VERSION} or greater not found.  Please check the QT_QMAKE_EXECUTABLE variable.")
  ELSE(NOT QT4_FOUND)
    # don't go greater than supported version
    STRING(REGEX MATCH "^4\\.6\\.[0-9]+" qt_version_46_match "${QTVERSION}")
    IF (NOT qt_version_46_match)
      STRING(REGEX MATCH "^4\\.[0-4]+\\.[0-9]+" qt_version46_x_tmp "${QTVERSION}")
      IF (qt_version46_x_tmp)
        MESSAGE(SEND_ERROR "Qt ${QTVERSION} not supported.  Please use ${QT_OFFICIAL_VERSION} (you may need to clean your dirtied cache).")
      ELSE (qt_version46_x_tmp)
        MESSAGE(WARNING "Warning: You are using Qt ${QTVERSION}. Officially supported version is Qt ${QT_OFFICIAL_VERSION}")
      ENDIF (qt_version46_x_tmp)
    ENDIF (NOT qt_version_46_match)
  ENDIF(NOT QT4_FOUND)
ELSE (PARAVIEW_BUILD_QT_GUI)
  SET(VTK_USE_QT OFF CACHE BOOL "Build VTK with Qt Support" FORCE)
ENDIF (PARAVIEW_BUILD_QT_GUI)
# Mark these Qt variables as advanced. Users don't really have to set them.
MARK_AS_ADVANCED(VTK_USE_QT VTK_USE_QTCHARTS VTK_USE_GUISUPPORT)
MARK_AS_ADVANCED(QT_MKSPECS_DIR QT_PLUGINS_DIR QT_X11_X11_LIBRARY QT_X11_Xext_LIBRARY QT_X11_m_LIBRARY)
# these should be all marked as advanced automatically but FindQt4 in cmake ...
MARK_AS_ADVANCED(QT_QTMOTIF_INCLUDE_DIR QT_QTMOTIF_LIBRARY_DEBUG QT_QTMOTIF_LIBRARY_RELEASE QT_HELP_GENERATOR)

# Mark certain VTK variables as advanced. Users do not really have to set these.
IF (APPLE)
  MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES CMAKE_OSX_SYSROOT VTK_USE_CARBON VTK_USE_COCOA VTK_APPLE_RESOURCE)
ENDIF(APPLE)
MARK_AS_ADVANCED(VTK_USE_MPEG2_ENCODER QT_PLUGINS_DIR QT_MKSPECS_DIR VTK_USE_MFC XDMF_BUILD_UTILS XDMF_USE_BZIP2 XDMF_USE_GZIP QT_QTDESIGNER_INCLUDE_DIR)

#########################################################################
# Define a PARAVIEW_USE_MPI that is not advanced
SET(PARAVIEW_USE_MPI OFF CACHE BOOL "Build ParaView with MPI support")
SET(VTK_USE_MPI ${PARAVIEW_USE_MPI} CACHE INTERNAL "Build VTK with MPI support" FORCE)
# define this variable so that VTK_DEPENDENT_OPTION in the VTK 
# CMakeLists.txt does not turn VTK_USE_MPI back to a regular cache
# variable
# set it to PARAVIEW_USE_MPI so that VTK_USE_MPI is slaved to it.
SET(VTK_USE_MPI_ISSET ${PARAVIEW_USE_MPI})
IF (PARAVIEW_USE_MPI)
  FIND_PACKAGE(MPI)
  SET(PARAVIEW_USE_MPI_SSEND OFF CACHE BOOL
    "Use MPI synchronous-send commands for communication")
  MARK_AS_ADVANCED(PARAVIEW_USE_MPI_SSEND)
ENDIF (PARAVIEW_USE_MPI)

#########################################################################
# Force Infovis support on
SET(VTK_USE_INFOVIS ON CACHE BOOL "Build VTK with Infovis Support" FORCE)
MARK_AS_ADVANCED(VTK_USE_INFOVIS)

#########################################################################
# Force Charts support on
SET(VTK_USE_CHARTS ON CACHE BOOL "Build VTK with Charts Support" FORCE)
MARK_AS_ADVANCED(VTK_USE_CHARTS)

#########################################################################
#
MARK_AS_ADVANCED(VTK_USE_N_WAY_ARRAYS)
MARK_AS_ADVANCED(VTK_USE_TEXT_ANALYSIS)

#########################################################################
# Configure Testing
OPTION(BUILD_TESTING "Build ParaView Testing" ON)
IF(BUILD_TESTING)
  SET(PARAVIEW_TEST_DIR    ${ParaView_BINARY_DIR}/Testing/Temporary)
  MAKE_DIRECTORY(${PARAVIEW_TEST_DIR})
  ENABLE_TESTING()
  INCLUDE (CTest)
ENDIF(BUILD_TESTING)

#########################################################################
# Configure data directory
IF(NOT PARAVIEW_DATA_ROOT AND PARAQ_DATA_ROOT)
  SET(PARAVIEW_DATA_ROOT "${PARAQ_DATA_ROOT}")
ENDIF(NOT PARAVIEW_DATA_ROOT AND PARAQ_DATA_ROOT)
FIND_PATH(PARAVIEW_DATA_ROOT ParaViewData.readme
  ${ParaView_SOURCE_DIR}/ParaViewData
  ${ParaView_SOURCE_DIR}/../ParaViewData
  ${ParaView_SOURCE_DIR}/ParaQData
  ${ParaView_SOURCE_DIR}/../ParaQData
  $ENV{PARAVIEW_DATA_ROOT}
  )

#########################################################################
# Configure Python
OPTION(PARAVIEW_ENABLE_PYTHON "Enable/Disable Python scripting support." OFF)

# PARAVIEW_TESTING_WITH_PYTHON must be used only when PARAVIEW_ENABLE_PYTHON 
# is ON. If PARAVIEW_ENABLE_PYTHON is OFF, PARAVIEW_TESTING_WITH_PYTHON 
# is ignored and treated as disabled.
OPTION(PARAVIEW_TESTING_WITH_PYTHON 
    "Build Python Testing support if PARAVIEW_ENABLE_PYTHON is ON"  
    ON)
MARK_AS_ADVANCED(PARAVIEW_TESTING_WITH_PYTHON)

IF (PARAVIEW_TESTING_WITH_PYTHON AND PARAVIEW_ENABLE_PYTHON)
  SET (QT_TESTING_WITH_PYTHON ON)
ELSE (PARAVIEW_TESTING_WITH_PYTHON AND PARAVIEW_ENABLE_PYTHON)
  SET (QT_TESTING_WITH_PYTHON OFF)
ENDIF (PARAVIEW_TESTING_WITH_PYTHON AND PARAVIEW_ENABLE_PYTHON)

IF (PARAVIEW_ENABLE_PYTHON AND PV_TARGET_SUPPORTS_SHARED_LIBS)
  SET(BUILD_SHARED_LIBS ON CACHE BOOL "Build ParaView using shared libraries" FORCE)
ENDIF (PARAVIEW_ENABLE_PYTHON AND PV_TARGET_SUPPORTS_SHARED_LIBS)

IF (PARAVIEW_ENABLE_PYTHON)
  SET(VTK_WRAP_PYTHON ON CACHE INTERNAL "" FORCE)
  SET(VTK_WRAP_PYTHON_EXE vtkWrapPython)
  SET(VTK_WRAP_PYTHON_INIT_EXE vtkWrapPythonInit)

  # ParaView python uses NewInterpretor API, which cannot be used with the
  # python's thread support API (PyGIL*). Hence, we disable all thread support.
  # No mutiple threads in paraview. Sorry.
  SET(VTK_NO_PYTHON_THREADS 1 CACHE INTERNAL "Build VTK with MPI support" FORCE)
ELSE (PARAVIEW_ENABLE_PYTHON)
  SET(VTK_WRAP_PYTHON OFF CACHE INTERNAL "" FORCE)
ENDIF (PARAVIEW_ENABLE_PYTHON)

#########################################################################
# Set the EncodeString executable
SET(VTK_ENCODESTRING_EXE vtkEncodeString)

#########################################################################
# Set the ServerManager test data dir,
SET(PVServerManagerTestData ${PARAVIEW_DATA_ROOT})

# Find hints file for the client/server wrapping
FIND_FILE(VTK_WRAP_HINTS hints ${ParaView_SOURCE_DIR}/VTK/Wrapping NO_CMAKE_FIND_ROOT_PATH)
MARK_AS_ADVANCED(VTK_WRAP_HINTS)

#########################################################################
# Any build configured headers should be added to this 
# variable so that they also get installed.
SET (dynamicHeaders)

#########################################################################
#
# add directories
#
#########################################################################

#########################################################################
# Include the file that most of the environment setup (except GUI)
# It also adds the VTK directories
SET(VTK_MAKE_INSTANTIATOR       "${ParaView_SOURCE_DIR}/VTK/CMake")
SET(VTKCS_CONFIG_DIR            "${ParaView_SOURCE_DIR}/Utilities/VTKClientServer/CMake")

SET(ParaView_CMAKE_DIR "${ParaView_SOURCE_DIR}/CMake")
SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ParaView_CMAKE_DIR})

# used in ParaViewPlugins.cmake
SET(ParaView_QT_DIR ${ParaView_SOURCE_DIR}/Qt)
SET(PARAVIEW_QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE})

# Check that the Git submodules have been initialized correctly, and the local
# Git hooks have been installed.
INCLUDE(ParaViewCheckSourceTree)

INCLUDE(ParaViewMacros)
INCLUDE(ParaViewCommon)
INCLUDE(ParaViewPlugins)
INCLUDE(ParaViewBranding)
INCLUDE(ParaViewBrandingCPack)

#########################################################################
IF(BUILD_DOCUMENTATION)
  ADD_SUBDIRECTORY(Utilities/Doxygen)
ENDIF(BUILD_DOCUMENTATION)

# Documentation exists as a qch file. -> Don't build it if no Gui.
IF (PARAVIEW_BUILD_QT_GUI)
  ADD_SUBDIRECTORY(Documentation)
ENDIF (PARAVIEW_BUILD_QT_GUI)
#########################################################################
IF (PARAVIEW_BUILD_QT_GUI)
  ADD_SUBDIRECTORY(Qt)
ENDIF (PARAVIEW_BUILD_QT_GUI)

#########################################################################
OPTION(BUILD_EXAMPLES "Build ParaView examples." OFF)
IF (BUILD_EXAMPLES)
  ADD_SUBDIRECTORY(Examples)
ENDIF (BUILD_EXAMPLES)

#########################################################################
# Additional definitions for ParaViewConfig.cmake
SET(PARAVIEW_USE_FILE "${ParaView_SOURCE_DIR}/ParaViewUse.cmake")
SET(PARAVIEW_VTK_DIR "${ParaView_BINARY_DIR}/VTK")

#SET(PARAVIEW_CMAKE_EXTENSIONS "${ParaView_SOURCE_DIR}/CMake;${ParaView_SOURCE_DIR}/VTK/CMake")
IF("${CMAKE_CFG_INTDIR}" STREQUAL ".")
  SET(VTK_WRAP_ClientServer_EXE_CONFIG ${EXECUTABLE_OUTPUT_PATH}/vtkWrapClientServer)
ELSE("${CMAKE_CFG_INTDIR}" STREQUAL ".")
  SET(VTK_WRAP_ClientServer_EXE_CONFIG ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/vtkWrapClientServer)
ENDIF("${CMAKE_CFG_INTDIR}" STREQUAL ".")

SET(PARAVIEW_LIBRARY_DIRS 
  ${LIBRARY_OUTPUT_PATH} ${PARAVIEW_EXTRA_LINK_DIRECTORIES})

SET(PARAVIEW_GUI_INCLUDE_DIRS ${ParaView_SOURCE_DIR}/VTK/GUISupport/Qt
                              ${ParaView_BINARY_DIR}/VTK/GUISupport/Qt
                              ${ParaView_SOURCE_DIR}/Qt/Widgets
                              ${ParaView_BINARY_DIR}/Qt/Widgets
                              ${ParaView_SOURCE_DIR}/Qt/Chart
                              ${ParaView_BINARY_DIR}/Qt/Chart
                              ${ParaView_SOURCE_DIR}/Qt/Core
                              ${ParaView_BINARY_DIR}/Qt/Core
                              ${ParaView_BINARY_DIR}/Qt/Core/Resources/UI
                              ${ParaView_SOURCE_DIR}/Qt/Components
                              ${ParaView_BINARY_DIR}/Qt/Components
                              ${ParaView_BINARY_DIR}/Qt/Components/Resources/UI
                              ${ParaView_SOURCE_DIR}/Qt/ApplicationComponents
                              ${ParaView_BINARY_DIR}/Qt/ApplicationComponents
                              ${ParaView_BINARY_DIR}/Qt/ApplicationComponents/Resources/UI
                              ${ParaView_SOURCE_DIR}/Qt/Testing
                              ${ParaView_BINARY_DIR}/Qt/Testing )
IF (PARAVIEW_ENABLE_PYTHON)
  SET (PARAVIEW_GUI_INCLUDE_DIRS ${PARAVIEW_GUI_INCLUDE_DIRS}
                                 ${ParaView_SOURCE_DIR}/Qt/Python
                                 ${ParaView_BINARY_DIR}/Qt/Python)
ENDIF(PARAVIEW_ENABLE_PYTHON)

SET(PARAVIEW_KWSYS_INCLUDE_DIRS ${PARAVIEW_INCLUDE_DIRS})
SET(PARAVIEW_SERVER_MANAGER_RESOURCES_DIRECTORY 
  "${ParaView_SOURCE_DIR}/Servers/ServerManager/Resources")

# Few more variable needed in ParaViewConfig.cmake
# We don't worry about the debug/release configuration directories on windows
# here since when using these variables in tests, ctest handles it as well as
# smTestDriver handles it.
SET(PARAVIEW_BATCH_EXECUTABLE         ${EXECUTABLE_OUTPUT_PATH}/pvbatch${PV_EXE_SUFFIX} )
SET(PARAVIEW_PYTHON_EXECUTABLE        ${EXECUTABLE_OUTPUT_PATH}/pvpython${PV_EXE_SUFFIX} )
SET(PARAVIEW_SERVER_EXECUTABLE        ${EXECUTABLE_OUTPUT_PATH}/pvserver${PV_EXE_SUFFIX} )
SET(PARAVIEW_DATA_SERVER_EXECUTABLE   ${EXECUTABLE_OUTPUT_PATH}/pvdataserver${PV_EXE_SUFFIX} )
SET(PARAVIEW_RENDER_SERVER_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/pvrenderserver${PV_EXE_SUFFIX} )
SET(PARAVIEW_SMTESTDRIVER_EXECUTABLE  ${EXECUTABLE_OUTPUT_PATH}/smTestDriver${PV_EXE_SUFFIX} )

# Since this is used in custom commands etc. we use LOCATION so that the
# release/debug configuration gets considered.
GET_TARGET_PROPERTY(PARAVIEW_PROCESS_XML_EXECUTABLE kwProcessXML LOCATION)


ADD_SUBDIRECTORY(Plugins)

#########################################################################
IF (PARAVIEW_BUILD_QT_GUI)
  # Applications MUST be configured after plugins, so they can override
  # the plugin configuration when necessary.
  ADD_SUBDIRECTORY(Applications)
ENDIF (PARAVIEW_BUILD_QT_GUI)

####################################################################################
# Export Targets file.
SET(PARAVIEW_TARGETS_FILE "${CMAKE_BINARY_DIR}/${PV_INSTALL_EXPORT_NAME}.cmake")

GET_PROPERTY(VTK_TARGETS GLOBAL PROPERTY VTK_TARGETS)
# The PYTHON_ADD_MODULE macro stores the list of static modules in a global property
GET_PROPERTY(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST)
EXPORT(TARGETS ${VTK_TARGETS} ${PY_STATIC_MODULES_LIST} FILE ${PARAVIEW_TARGETS_FILE})

#########################################################################
# Configure the CoProcessing library
OPTION(PARAVIEW_ENABLE_COPROCESSING "Enable/Disable the CoProcessing library." OFF)
MARK_AS_ADVANCED(PARAVIEW_ENABLE_COPROCESSING)
IF (PARAVIEW_ENABLE_COPROCESSING)
  ADD_SUBDIRECTORY (CoProcessing)
ENDIF (PARAVIEW_ENABLE_COPROCESSING)

# Perform build tree configuration. Install configuration is
# handled below.
CONFIGURE_FILE(
    ${ParaView_SOURCE_DIR}/ParaViewConfig.cmake.in
    ${ParaView_BINARY_DIR}/ParaViewConfig.cmake 
    @ONLY IMMEDIATE)

CONFIGURE_FILE(
    ${ParaView_SOURCE_DIR}/ParaViewConfigVersion.cmake.in
    ${ParaView_BINARY_DIR}/ParaViewConfigVersion.cmake
    @ONLY IMMEDIATE)
    
# used by the ParaViewConfig file to determine where the parts of the tree are located relative to the ParaViewConfig file.
set(REL_REF "")

#######################################################################
# INSTALL
IF (NOT PV_INSTALL_NO_DEVELOPMENT)
  MESSAGE(STATUS "Configuring development install...")

  # Install Targets export file.
  INSTALL(EXPORT ${PV_INSTALL_EXPORT_NAME} DESTINATION ${PV_INSTALL_CMAKE_DIR})

  INSTALL(
      FILES ${dynamicHeaders} 
      DESTINATION ${PV_INSTALL_INCLUDE_DIR}
      COMPONENT Development)

  SET(cmakeDevFiles
      ${ParaView_CMAKE_DIR}/branded_splash.png
      ${ParaView_SOURCE_DIR}/ParaViewUse.cmake
      ${ParaView_CMAKE_DIR}/ParaViewMacros.cmake
      ${ParaView_CMAKE_DIR}/ParaViewPlugins.cmake
      ${ParaView_CMAKE_DIR}/ParaViewBranding.cmake
      ${ParaView_CMAKE_DIR}/ParaViewBrandingCPack.cmake
      ${ParaView_CMAKE_DIR}/pqParaViewPlugin.cxx.in
      ${ParaView_CMAKE_DIR}/pqParaViewPlugin.h.in
      ${ParaView_CMAKE_DIR}/branded_paraview_initializer.cxx.in
      ${ParaView_CMAKE_DIR}/branded_paraview_main.cxx.in
      ${ParaView_CMAKE_DIR}/branded_paraview_initializer.h.in
      ${ParaView_CMAKE_DIR}/ParaViewCPackOptions.cmake.in
      ${ParaView_CMAKE_DIR}/pv-forward.c.in
      # originaly from Qt/Components
      ${ParaView_CMAKE_DIR}/pqObjectPanelImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqObjectPanelImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqDisplayPanelImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqDisplayPanelImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqViewOptionsImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqViewOptionsImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqActionGroupImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqActionGroupImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqViewFrameActionGroupImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqViewFrameActionGroupImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqDockWindowImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqDockWindowImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqDisplayPanelDecoratorImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqDisplayPanelDecoratorImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pq3DWidgetImplementation.h.in
      ${ParaView_CMAKE_DIR}/pq3DWidgetImplementation.cxx.in
      # originaly from Qt/Core
      ${ParaView_CMAKE_DIR}/pqViewModuleImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqViewModuleImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqAutoStartImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqAutoStartImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqGraphLayoutStrategyImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqGraphLayoutStrategyImplementation.cxx.in
      ${ParaView_CMAKE_DIR}/pqTreeLayoutStrategyImplementation.h.in
      ${ParaView_CMAKE_DIR}/pqTreeLayoutStrategyImplementation.cxx.in)
  INSTALL(
      FILES ${cmakeDevFiles} 
      DESTINATION ${PV_INSTALL_CMAKE_DIR}
      COMPONENT Development)
      
  # Re-configure for the install.
  SET(SOURCE_TREE                                  ${ParaView_SOURCE_DIR})
  SET(BUILD_TREE                                   ${ParaView_BINARY_DIR}) 
  SET(ParaView_CMAKE_DIR                          "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}")
  SET(ParaView_BINARY_DIR                         "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}")
  SET(PARAVIEW_USE_FILE                           "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}/ParaViewUse.cmake")
  SET(PARAVIEW_VTK_DIR                            "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_LIB_DIR}")
  SET(VTK_WRAP_ClientServer_EXE_CONFIG            "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/vtkWrapClientServer")
  SET(PARAVIEW_INCLUDE_DIRS                       "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_INCLUDE_DIR}")
  SET(ParaView_QT_DIR                             "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_INCLUDE_DIR}/Qt")
  SET(PARAVIEW_QT_QMAKE_EXECUTABLE                "")
  SET(PARAVIEW_GUI_INCLUDE_DIRS                   "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_INCLUDE_DIR}")
  SET(PARAVIEW_KWSYS_INCLUDE_DIRS                 "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_INCLUDE_DIR}")
  SET(PARAVIEW_LIBRARY_DIRS                       "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_LIB_DIR}")
  SET(PARAVIEW_GUI_CLIENT_EXECUTABLE              "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/paraview${PV_EXE_SUFFIX}")
  SET(PARAVIEW_BATCH_EXECUTABLE                   "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/pvbatch${PV_EXE_SUFFIX}")
  SET(PARAVIEW_PROCESS_XML_EXECUTABLE             "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/kwProcessXML${PV_EXE_SUFFIX}")
  SET(PARAVIEW_PYTHON_EXECUTABLE                  "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/pvpython${PV_EXE_SUFFIX}")
  SET(PARAVIEW_SERVER_EXECUTABLE                  "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/pvserver${PV_EXE_SUFFIX}")
  SET(PARAVIEW_DATA_SERVER_EXECUTABLE             "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/pvdataserver${PV_EXE_SUFFIX}")
  SET(PARAVIEW_RENDER_SERVER_EXECUTABLE           "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/pvrenderserver${PV_EXE_SUFFIX}")
  SET(PARAVIEW_SMTESTDRIVER_EXECUTABLE            "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_BIN_DIR}/smTestDriver${PV_EXE_SUFFIX}")
  SET(PARAVIEW_SERVER_MANAGER_RESOURCES_DIRECTORY "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_LIB_DIR}/Servers/ServerManager/Resources")
  SET(VTKCS_CONFIG_DIR                            "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}")
  SET(PARAVIEW_TARGETS_FILE                       "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}/${PV_INSTALL_EXPORT_NAME}.cmake")
  SET(VTK_MAKE_INSTANTIATOR                       "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}")
  SET(VISITBRIDGE_CMAKE_DIR                       "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}")
  SET(VISITBRIDGE_USE_FILE                        "\${ParaView_INSTALL_PREFIX}/${PV_INSTALL_CMAKE_DIR}/VisItBridgeUse.cmake")
  
  set(REL_REF)
  IF(NOT WIN32)
    set(REL_REF "/../..")
  ENDIF(NOT WIN32)

  CONFIGURE_FILE(
      "${SOURCE_TREE}/ParaViewConfig.cmake.in"
      "${BUILD_TREE}/CMake/tmp/ParaViewConfig.cmake"
      @ONLY IMMEDIATE)

      
  IF(WIN32)
    INSTALL(
        FILES "${BUILD_TREE}/CMake/tmp/ParaViewConfig.cmake"
          "${BUILD_TREE}/ParaViewConfigVersion.cmake"
        DESTINATION .
        COMPONENT Development)
  ELSE(WIN32)
    INSTALL(
        FILES "${BUILD_TREE}/CMake/tmp/ParaViewConfig.cmake"
          "${BUILD_TREE}/ParaViewConfigVersion.cmake"
        DESTINATION ${PV_INSTALL_LIB_DIR}
        COMPONENT Development)
  ENDIF(WIN32)

ENDIF (NOT PV_INSTALL_NO_DEVELOPMENT)

