-SET(SUBDIRS
- idl
- adm_local
- resources
- src
- doc
- bin
- )
-
-SET(DISTCLEANFILES
- wrapfiles.txt
- )
-
-INCLUDE(wrapfiles.cmake)
-
-SET(input ${CMAKE_CURRENT_SOURCE_DIR}/PARAVIS_version.h.in)
-SET(output ${CMAKE_CURRENT_BINARY_DIR}/PARAVIS_version.h)
-
-MESSAGE(STATUS "Creation of ${output}")
-CONFIGURE_FILE(${input} ${output})
-
-FOREACH(dir ${SUBDIRS})
- ADD_SUBDIRECTORY(${dir})
-ENDFOREACH(dir ${SUBDIRS})
-
-# Reset CMAKE_CONFIGURATION_TYPES to the good value defined by CMAKE_BUILD_TYPE
-IF(CMAKE_BUILD_TYPE)
- IF(WINDOWS)
- MARK_AS_ADVANCED(CLEAR CMAKE_CONFIGURATION_TYPES)
- SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "compilation types" FORCE)
- ENDIF(WINDOWS)
-ENDIF(CMAKE_BUILD_TYPE)
-
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PARAVIS_version.h DESTINATION include/salome)
-
-# Configure Testing
-SET(PARAVIS_TEST_OUTPUT_DIR /tmp/pic CACHE PATH "Directory for saving test pictures.")
-OPTION(BUILD_TESTING "Build ParaVis Testing" ON)
-IF(BUILD_TESTING)
- SET(PARAVIS_TEST_DIR ${ParaVis_BINARY_DIR}/Test/Temporary)
- MAKE_DIRECTORY(${PARAVIS_TEST_DIR})
- ENABLE_TESTING()
- INCLUDE (CTest)
- ADD_SUBDIRECTORY(test)
-ENDIF(BUILD_TESTING)
+# Accumulate environment variables for PARAVIS module
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
+ ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
+SALOME_ACCUMULATE_ENVIRONMENT(PV_PLUGIN_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/lib/paraview)
+
+# Sources
+# ========
+IF(NOT SALOME_LIGHT_ONLY)
+ ADD_SUBDIRECTORY(idl) # Order matters when using the wrapping - to be added AFTER src
+ENDIF()
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(adm_local)
+ADD_SUBDIRECTORY(resources)
+
+IF(SALOME_BUILD_DOC)
+ ADD_SUBDIRECTORY(doc)
+ENDIF()
+IF(SALOME_BUILD_TESTS AND NOT SALOME_LIGHT_ONLY)
+ ADD_SUBDIRECTORY(test)
+ENDIF()
+ADD_SUBDIRECTORY(bin)
+ADD_SUBDIRECTORY(examples)
+
+# Header configuration
+# ====================
+SALOME_XVERSION(${PROJECT_NAME})
+SALOME_CONFIGURE_FILE(PARAVIS_version.h.in PARAVIS_version.h INSTALL ${SALOME_INSTALL_HEADERS})
+
+# Configuration export
+# (here only the level 1 prerequisites are exposed)
+# ====================
+INCLUDE(CMakePackageConfigHelpers)
+
+# List of targets in this project we want to make visible to the rest of the world.
+# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
+IF(NOT SALOME_LIGHT_ONLY)
+ SET(_${PROJECT_NAME}_exposed_targets SalomeIDLPVServer PARAVIS)
+
+ # Add all targets to the build-tree export set
+ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
+ FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
+ENDIF()
+
+# Create the configuration files:
+# - in the build tree:
+
+# Ensure the variables are always defined for the configure:
+SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
+SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
+SET(MED_ROOT_DIR "${MED_ROOT_DIR}")
+SET(MEDFILE_ROOT_DIR "${MEDFILE_ROOT_DIR}")
+
+SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
+
+# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
+SALOME_CONFIGURE_PREPARE(MEDFile)
+
+CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
+ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+ INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
+ PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
+ KERNEL_ROOT_DIR GUI_ROOT_DIR MED_ROOT_DIR MEDFILE_ROOT_DIR)
+
+# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
+# Get the relative path of the include directory so
+# we can register it in the generated configuration files:
+#SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
+#CONFIGURE_PACKAGE_CONFIG_FILE(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.in
+# ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
+# INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
+# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
+# KERNEL_ROOT_DIR GUI_ROOT_DIR MED_ROOT_DIR MEDFILE_ROOT_DIR)
+
+WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+ VERSION ${${PROJECT_NAME_UC}_VERSION}
+ COMPATIBILITY AnyNewerVersion)
+
+# Install the CMake configuration files:
+INSTALL(FILES
+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
+
+IF(NOT SALOME_LIGHT_ONLY)
+ # Install the export set for use with the install-tree
+ INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
+ FILE ${PROJECT_NAME}Targets.cmake)
+ENDIF()