-# From GUI:
-FIND_PACKAGE(SalomeCAS REQUIRED)
-FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtHelp)
-message("QT_INCLUDES ${QT_INCLUDES}")
-SET(_new_inc)
-FOREACH(_inc ${QT_INCLUDES})
- SET(_new_inc "${_new_inc} -I${_inc}")
-ENDFOREACH()
-SET(QT_INCLUDES "${_new_inc}")
-message("QT_INCLUDES ${QT_INCLUDES}")
-
-FIND_PACKAGE(SalomeOpenGL REQUIRED)
-FIND_PACKAGE(SalomeVTK REQUIRED)
-FIND_PACKAGE(SalomeQwt REQUIRED)
-FIND_PACKAGE(SalomeSIP REQUIRED)
-FIND_PACKAGE(SalomePyQt4 REQUIRED)
-
-SET(VERSION_MAJOR 7)
-SET(VERSION_MINOR 2)
-SET(VERSION_MAINTENANCE 0)
-SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MAINTENANCE}")
-SET(XVERSION 0x0${VERSION_MAJOR}0${VERSION_MINOR}0${VERSION_MAINTENANCE})
-SET(VERSION_DEV 0)
-
-SET(BUILD_PLUGINS 1)
-
-#SET(VISU_ROOT_DIR $ENV{VISU_ROOT_DIR} CACHE PATH "VISU_ROOT_DIR")
-#IF(EXISTS ${VISU_ROOT_DIR}/adm_local/cmake_files/FindVISU.cmake)
- #INCLUDE(${VISU_ROOT_DIR}/adm_local/cmake_files/FindVISU.cmake)
- #SET(WITH_VISU 1)
-#ENDIF(EXISTS ${VISU_ROOT_DIR}/adm_local/cmake_files/FindVISU.cmake)
-
-SET(MED_ROOT_DIR "$ENV{MED_ROOT_DIR}" CACHE PATH "Path to the MED Salome module")
-LIST(APPEND CMAKE_MODULE_PATH "${MED_ROOT_DIR}/adm_local/cmake_files")
-FIND_PACKAGE(SalomeMED REQUIRED)
-FIND_PACKAGE(SalomeMEDFile REQUIRED)
-
-# TODO: the below requires ParaView in the PYTHONPATH ... not so nice:
-MESSAGE(STATUS "Generating wrapped class list (??) ...")
-LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0)
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_INCLUDE_DIR0}
- RESULT_VARIABLE _res)
-IF(NOT _res EQUAL 0)
- MESSAGE(FATAL_ERROR "Unable to run the Python script retrieving the list of VTK classes.")
+##
+## From GUI: part 2
+##
+FIND_PACKAGE(SalomeCAS REQUIRED) # [ABN] I wish I could avoid that ...
+
+##
+## From MED
+##
+IF(SALOME_PARAVIS_BUILD_PLUGINS)
+ SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR} CACHE PATH "Path to the Salome MED module")
+ IF(EXISTS ${MED_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${MED_ROOT_DIR}/adm_local/cmake_files")
+ FIND_PACKAGE(SalomeMED REQUIRED)
+ ELSE()
+ MESSAGE(FATAL_ERROR "We absolutely need the Salome MED module to build plugins, please define MED_ROOT_DIR")
+ ENDIF()
+ IF(SALOME_MED_STANDALONE OR SALOME_MED_MICROMED)
+ MESSAGE(FATAL_ERROR "We absolutely need a Salome MED with KERNEL and with MED file dependancy,
+ please set SALOME_MED_STANDALONE=OFF and SALOME_MED_MICROMED=OFF in MED module
+ or SALOME_PARAVIS_BUILD_PLUGINS=OFF in PARAVIS module")
+ ENDIF()
+ FIND_PACKAGE(SalomeMEDFile)
+ SALOME_LOG_OPTIONAL_PACKAGE(MEDFile SALOME_PARAVIS_BUILD_PLUGINS)
+ENDIF()
+
+## Detection summary:
+SALOME_PACKAGE_REPORT_AND_CHECK()
+
+# Directories
+# (default values taken from KERNEL)
+# ===========
+SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
+SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
+SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
+SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
+ "Install path: SALOME scripts")
+SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
+ "Install path: SALOME script data")
+SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
+ "Install path: SALOME Python scripts")
+SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
+SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
+ "Install path: SALOME Python shared modules")
+SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Install path: SALOME CMake files")
+SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
+ "Install path: local SALOME CMake files")
+SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
+ "Install path: local SALOME config files (obsolete, to be removed)")
+
+SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
+SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
+
+# Specific to PARAVIS:
+SET(SALOME_PARAVIS_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/paravis" CACHE PATH "Install path: SALOME PARAVIS specific data")
+
+MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
+MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
+MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
+MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
+MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC SALOME_PARAVIS_INSTALL_RES_DATA)
+
+## Generation of the list of VTK classes (to be wrapped into IDLs)
+## =====================================
+IF(NOT SALOME_LIGHT_ONLY AND NOT SALOME_PARAVIS_MINIMAL_CORBA)
+ ADD_DEFINITIONS(-DPARAVIS_WITH_FULL_CORBA)
+ # TODO: the below requires ParaView in the PYTHONPATH ... not so nice:
+ MESSAGE(STATUS "Generating list of wrapped VTK classes ...")
+ LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0)
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/VTKWrapping/getwrapclasses.py ${PARAVIEW_INCLUDE_DIR0}
+ RESULT_VARIABLE _res)
+ IF(NOT _res EQUAL 0)
+ MESSAGE(FATAL_ERROR "Unable to run the Python script retrieving the list of VTK classes.")
+ ENDIF()
+ENDIF()
+
+# 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