-# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
+INCLUDE(CMakeDependentOption)
+PROJECT(SalomeMED C CXX)
-IF(COMMAND cmake_policy)
- cmake_policy(SET CMP0003 NEW)
-ENDIF(COMMAND cmake_policy)
+# Ensure a proper linker behavior:
+CMAKE_POLICY(SET CMP0003 NEW)
-ENABLE_TESTING()
-SET(VERSION "7.0.0")
-SET(VERSION_DEV "1")
-SET(WITH_MEDMEMGUI "0")
+# Versioning
+# ===========
+# Project name, upper case
+STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
-#Defining all options first
-option(SALOME_USE_MPI "Use MPI containers" OFF)
+SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
+SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
+SET(${PROJECT_NAME_UC}_VERSION
+ ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
-SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
-IF(KERNEL_ROOT_DIR)
- FILE(TO_CMAKE_PATH $ENV{KERNEL_ROOT_DIR} KERNEL_ROOT_DIR)
- SET(MED_ENABLE_KERNEL ON)
-
- SET(SALOME_MACROS_DIR ${KERNEL_ROOT_DIR}/salome_adm/cmake_files)
-
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindPLATFORM.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindPYTHON.cmake)
- if(SALOME_USE_MPI)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindMPI.cmake)
- endif(SALOME_USE_MPI)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindOMNIORB.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindPTHREADS.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindHDF5.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindBOOST.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindLIBXML2.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindSWIG.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindDOXYGEN.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSalomeLIBBATCH.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindKERNEL.cmake)
-
- SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
- FILE(TO_CMAKE_PATH $ENV{GUI_ROOT_DIR} GUI_ROOT_DIR)
- IF(GUI_ROOT_DIR)
- SET(MED_ENABLE_GUI ON)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindCAS.cmake)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindQT4.cmake)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindOPENGL.cmake)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSalomeVTK.cmake)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindQWT.cmake)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindSIPPYQT.cmake)
- INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindGUI.cmake)
- ENDIF(GUI_ROOT_DIR)
-ELSE(KERNEL_ROOT_DIR)
- SET(SALOME_MACROS_DIR ${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files)
-
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake)
- if(SALOME_USE_MPI)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)
- endif(SALOME_USE_MPI)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindBOOST.cmake)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindCPPUNIT.cmake)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindHDF5.cmake)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPYTHON.cmake)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindLIBXML2.cmake)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPTHREADS.cmake)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindSWIG.cmake)
-
-ENDIF(KERNEL_ROOT_DIR)
-
-INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindPARMETIS.cmake)
-INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMETIS.cmake)
-INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSCOTCH.cmake)
-INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSPLITTER.cmake)
-INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindRENUMBER.cmake)
-INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
+#
+# Kernel detection comes before user options to be
+# able to take previous values of global options ...
+#
+SET(_default_MPI OFF)
+IF(NOT SALOME_MED_STANDALONE)
+ SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
+ IF(EXISTS ${KERNEL_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+ INCLUDE(SalomeMacros)
+ FIND_PACKAGE(SalomeKERNEL REQUIRED)
+ KERNEL_WITH_CORBA() #check whether KERNEL builded with CORBA
+ ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
+ INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
+ SET(_default_MPI ${SALOME_USE_MPI})
+ ELSE(EXISTS ${KERNEL_ROOT_DIR})
+ MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR or turn option SALOME_MED_STANDALONE to ON !")
+ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+ELSE(NOT SALOME_MED_STANDALONE)
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local_without_kernel/cmake_files")
+ INCLUDE(SalomeMacros)
+ENDIF(NOT SALOME_MED_STANDALONE)
+
+# Platform setup
+# ==============
+INCLUDE(SalomeSetupPlatform)
+
+IF(NOT SALOME_MED_STANDALONE)
+ FIND_PACKAGE(SalomePThread REQUIRED) # for MEDCouplingCorba/Test for EDF
+ FIND_PACKAGE(SalomeOmniORB REQUIRED)
+ENDIF(NOT SALOME_MED_STANDALONE)
+#
+# User options
+# ============
+INCLUDE(CMakeDependentOption)
+OPTION(SALOME_MED_STANDALONE "Build MED without CORBA bindings. When OFF, exchange to PARAVIS is disabled." OFF)
+OPTION(SALOME_MED_MICROMED "Build MED without MED file dependancy." OFF)
+OPTION(SALOME_MED_ENABLE_PYTHON "Build PYTHON bindings." ON)
+OPTION(SALOME_MED_ENABLE_PARTITIONER "Build MEDPartitioner." ON)
+OPTION(SALOME_MED_ENABLE_RENUMBER "Build Renumber." ON)
+OPTION(SALOME_MED_WITH_FILE_EXAMPLES "Install examples of files containing meshes and fields of different formats." ON)
+OPTION(SALOME_USE_MPI "(Use MPI containers) - For MED this triggers the build of ParaMEDMEM." ${_default_MPI})
+CMAKE_DEPENDENT_OPTION(SALOME_BUILD_GUI "Build GUI of MED." ON
+ "NOT SALOME_MED_STANDALONE" OFF)
+OPTION(SALOME_BUILD_TESTS "Build MED tests." ON)
+OPTION(SALOME_BUILD_DOC "Build MED doc." ON)
+CMAKE_DEPENDENT_OPTION(SALOME_MED_PARTITIONER_METIS "Enable metis graph library in MEDPartitioner." ON "SALOME_MED_ENABLE_PARTITIONER" OFF)
+CMAKE_DEPENDENT_OPTION(SALOME_MED_PARTITIONER_SCOTCH "Enable scotch graph library in MEDPartitioner." ON "SALOME_MED_ENABLE_PARTITIONER;NOT SALOME_USE_MPI" OFF)
+CMAKE_DEPENDENT_OPTION(SALOME_MED_PARTITIONER_PARMETIS "Enable parmetis graph library in MEDPartitioner." ON "SALOME_MED_ENABLE_PARTITIONER;SALOME_USE_MPI" OFF)
IF(WIN32)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)
+ CMAKE_DEPENDENT_OPTION(SALOME_MED_MEDLOADER_USE_XDR "Enable use of XDR for SauvReader." ON "NOT SALOME_MED_MICROMED" OFF)
ENDIF(WIN32)
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; t=sys.argv[-1].split(\".\") ; t[:]=(int(elt) for elt in t) ; sys.stdout.write(\"0x%02x%02x%02x\"%tuple(t))" ${VERSION}
- OUTPUT_VARIABLE XVERSION)
+#
+# Set list of prerequisites
+# =========================
-SET(MED_salomebin_BINS bin/salome)
+IF(NOT SALOME_MED_STANDALONE)
+ SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
+ IF(EXISTS ${KERNEL_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+ INCLUDE(SalomeMacros)
+ FIND_PACKAGE(SalomeKERNEL REQUIRED)
+ KERNEL_WITH_CORBA() #check whether KERNEL builded with CORBA
+ ELSE(EXISTS ${KERNEL_ROOT_DIR})
+ MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR or turn option SALOME_MED_STANDALONE to ON !")
+ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
+ELSE(NOT SALOME_MED_STANDALONE)
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local_without_kernel/cmake_files")
+ INCLUDE(SalomeMacros)
+ENDIF(NOT SALOME_MED_STANDALONE)
-SET(MED_salomelib_LIBS lib/salome)
+IF(NOT SALOME_MED_MICROMED)
+ FIND_PACKAGE(SalomeHDF5 REQUIRED)
+ FIND_PACKAGE(SalomeMEDFile REQUIRED)
+ # XDR stuff
+ IF(NOT WIN32)
+ FIND_PACKAGE(SalomeXDR REQUIRED)
+ ELSE(NOT WIN32)
+ IF(SALOME_MED_MEDLOADER_USE_XDR)
+ FIND_PACKAGE(SalomeXDR REQUIRED)
+ ENDIF(SALOME_MED_MEDLOADER_USE_XDR)
+ ENDIF(NOT WIN32)
+ # End of XDR Stuff
+ IF(SALOME_MED_ENABLE_PARTITIONER)
+ FIND_PACKAGE(SalomeLibXml2)
+ SALOME_LOG_OPTIONAL_PACKAGE(LibXml2 SALOME_MED_ENABLE_PARTITIONER)
+ IF(SALOME_MED_PARTITIONER_METIS)
+ FIND_PACKAGE(SalomeMetis)
+ SALOME_LOG_OPTIONAL_PACKAGE(Metis SALOME_MED_PARTITIONER_METIS)
+ ADD_DEFINITIONS("-DMED_ENABLE_METIS")
+ ENDIF(SALOME_MED_PARTITIONER_METIS)
+ IF(SALOME_MED_PARTITIONER_SCOTCH)
+ FIND_PACKAGE(SalomeScotch)
+ SALOME_LOG_OPTIONAL_PACKAGE(Scotch SALOME_MED_PARTITIONER_SCOTCH)
+ ADD_DEFINITIONS("-DMED_ENABLE_SCOTCH")
+ ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
+ ENDIF(SALOME_MED_ENABLE_PARTITIONER)
+ENDIF(NOT SALOME_MED_MICROMED)
-SET(MED_salomeidl_IDLS idl/salome)
-SET(KERNEL_salomeidl_IDLS ${MED_salomeidl_IDLS})
+# Find GUI (optional)
+# ===========
+IF(SALOME_BUILD_GUI)
+ SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
+ IF(EXISTS ${GUI_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
+ FIND_PACKAGE(SalomeGUI REQUIRED)
+ FULL_GUI(TRUE) # check whether GUI builded in full mode and with CORBA
+ ADD_DEFINITIONS(${GUI_DEFINITIONS})
+ INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
+ ELSE(EXISTS ${GUI_ROOT_DIR})
+ MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR or turn option SALOME_BUILD_GUI to OFF !")
+ ENDIF(EXISTS ${GUI_ROOT_DIR})
+ FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
+ FIND_PACKAGE(SalomeCAS REQUIRED) # maybe one day it will disappear ...
+ENDIF(SALOME_BUILD_GUI)
-SET(MED_salomeinclude_HEADERS include/salome)
+LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
-SET(MED_salomeres_DATA share/salome/resources/med)
+ENABLE_TESTING() # let it outsite because even if SALOME_BUILD_TESTS is OFF, python tests that not need additional compilation can be run.
-SET(MED_salomeres_SCRIPTS share/salome/resources/med)
+IF(SALOME_BUILD_TESTS)
+ FIND_PACKAGE(SalomeCppUnit)
+ SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
+ENDIF(SALOME_BUILD_TESTS)
-SET(MED_salomescript_SCRIPTS bin/salome)
+IF(SALOME_USE_MPI)
+ FIND_PACKAGE(SalomeMPI REQUIRED)
+ ADD_DEFINITIONS("-DHAVE_MPI")
+ IF(SALOME_MED_PARTITIONER_PARMETIS)
+ FIND_PACKAGE(SalomeParMetis)
+ SALOME_LOG_OPTIONAL_PACKAGE(ParMetis SALOME_MED_PARTITIONER_PARMETIS)
+ ADD_DEFINITIONS("-DMED_ENABLE_PARMETIS")
+ ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
+ENDIF(SALOME_USE_MPI)
-SET(MED_salomescript_DATA bin/salome)
+IF(SALOME_MED_ENABLE_RENUMBER)
+ FIND_PACKAGE(SalomeBoost)
+ SALOME_LOG_OPTIONAL_PACKAGE(Boost SALOME_MED_ENABLE_RENUMBER)
+ENDIF(SALOME_MED_ENABLE_RENUMBER)
-SET(MED_salomescript_PYTHON bin/salome)
-SET(KERNEL_salomescript_PYTHON ${MED_salomescript_PYTHON})
+IF(SALOME_BUILD_DOC)
+ FIND_PACKAGE(SalomeDoxygen)
+ FIND_PACKAGE(SalomeGraphviz)
+ FIND_PACKAGE(SalomeSphinx)
+ SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
+ SALOME_LOG_OPTIONAL_PACKAGE(Graphviz SALOME_BUILD_DOC)
+ SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
+ENDIF(SALOME_BUILD_DOC)
-SET(MED_appliskel_SCRIPTS bin/salome/appliskel)
+IF(SALOME_MED_ENABLE_PYTHON)
+ FIND_PACKAGE(SalomePython)
+ FIND_PACKAGE(SalomeSWIG)
+ SALOME_LOG_OPTIONAL_PACKAGE(Python SALOME_MED_ENABLE_PYTHON)
+ SALOME_LOG_OPTIONAL_PACKAGE(SWIG SALOME_MED_ENABLE_PYTHON)
+ IF(NOT SALOME_MED_STANDALONE)
+ FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
+ ENDIF(NOT SALOME_MED_STANDALONE)
+ # Set the extra flags for SWIG for numpy and scipy
+ SET(SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY)
+ IF(NUMPY_FOUND)
+ SET(SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY "-DWITH_NUMPY")
+ ENDIF(NUMPY_FOUND)
+ IF(SCIPY_FOUND)
+ SET(SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY "${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY};-DWITH_SCIPY")
+ ENDIF(SCIPY_FOUND)
+ENDIF(SALOME_MED_ENABLE_PYTHON)
-SET(MED_appliskel_PYTHON bin/salome/appliskel)
+# Detection report
+SALOME_PACKAGE_REPORT_AND_CHECK()
+
+# Directories
+#
+# Directories have to be given after prerequisites (to be able to use
+# Python version string for example).
+# ===========
+SET(SALOME_INSTALL_BINS bin/salome CACHE PATH "Install path: SALOME binaries")
+SET(SALOME_INSTALL_LIBS lib/salome CACHE PATH "Install path: SALOME libs")
+SET(SALOME_INSTALL_IDLS idl/salome CACHE PATH "Install path: SALOME IDL files")
+SET(SALOME_INSTALL_HEADERS include/salome CACHE PATH "Install path: SALOME headers")
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS ${SALOME_INSTALL_BINS} CACHE PATH
+ "Install path: SALOME scripts")
+SET(SALOME_INSTALL_SCRIPT_DATA ${SALOME_INSTALL_BINS} CACHE PATH
+ "Install path: SALOME script data")
+SET(SALOME_INSTALL_SCRIPT_PYTHON ${SALOME_INSTALL_BINS} CACHE PATH
+ "Install path: SALOME Python scripts")
+SET(SALOME_INSTALL_APPLISKEL_SCRIPTS ${SALOME_INSTALL_BINS}/appliskel CACHE PATH
+ "Install path: SALOME application skeleton - scripts")
+SET(SALOME_INSTALL_APPLISKEL_PYTHON ${SALOME_INSTALL_BINS}/appliskel CACHE PATH
+ "Install path: SALOME application skeleton - Python")
+SET(SALOME_INSTALL_CMAKE salome_adm/cmake_files CACHE PATH "Install path: SALOME CMake files")
+SET(SALOME_INSTALL_CMAKE_LOCAL adm_local/cmake_files CACHE PATH
+ "Install path: local SALOME CMake files")
-SET(MED_pythondir lib/python${PYTHON_VERSION}/site-packages)
+IF(SALOME_MED_ENABLE_PYTHON)
+ SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
+ SET(SALOME_INSTALL_PYTHON ${_pydir}/salome CACHE PATH "Install path: SALOME Python stuff")
+ SET(SALOME_INSTALL_PYTHON_SHARED ${SALOME_INSTALL_PYTHON}/shared_modules CACHE PATH
+ "Install path: SALOME Python shared modules")
+ENDIF(SALOME_MED_ENABLE_PYTHON)
-SET(MED_salomepythondir ${MED_pythondir}/salome)
-SET(KERNEL_salomepythondir ${MED_salomepythondir})
+SET(SALOME_INSTALL_RES share/salome/resources CACHE PATH "Install path: SALOME resources")
+SET(SALOME_INSTALL_DOC share/doc/salome CACHE PATH "Install path: SALOME documentation")
-SET(MED_sharedpkgpython_PYTHON ${MED_salomepythondir}/shared_modules)
+# Med specific:
+
+SET(SALOME_MED_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/med" CACHE PATH "Install path: SALOME MED specific data")
+SET(SALOME_MED_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/med" CACHE PATH "Install path: SALOME MED specific scripts")
+
+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 SALOME_MED_INSTALL_RES_DATA SALOME_MED_INSTALL_RES_SCRIPTS SALOME_INSTALL_DOC)
+
+# Header configuration
+# ====================
+SALOME_XVERSION(${PROJECT_NAME})
+SALOME_CONFIGURE_FILE(MED_version.h.in MED_version.h INSTALL ${SALOME_INSTALL_HEADERS})
+SALOME_CONFIGURE_FILE(VERSION.in VERSION INSTALL ${SALOME_INSTALL_BINS})
+
+# Accumulate environment variables for MED 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})
+
+
+# Sources
+# ========
+IF(WIN32)
+ ADD_DEFINITIONS("-D_USE_MATH_DEFINES")
+ENDIF(WIN32)
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(adm_local)
-SET(MED_admlocalcmake adm_local/cmake_files)
+IF(SALOME_BUILD_DOC)
+ ADD_SUBDIRECTORY(doc)
+ENDIF(SALOME_BUILD_DOC)
-IF(MED_ENABLE_KERNEL)
+IF(NOT SALOME_MED_STANDALONE)
ADD_SUBDIRECTORY(idl)
-ELSE(MED_ENABLE_KERNEL)
+ELSE(NOT SALOME_MED_STANDALONE)
ADD_SUBDIRECTORY(adm_local_without_kernel)
-ENDIF(MED_ENABLE_KERNEL)
-ADD_SUBDIRECTORY(adm_local)
-ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(doc)
-ADD_SUBDIRECTORY(resources)
-ADD_SUBDIRECTORY(bin)
-
-SET(input ${CMAKE_CURRENT_SOURCE_DIR}/MED_version.h.in)
-SET(output ${CMAKE_CURRENT_BINARY_DIR}/MED_version.h)
-MESSAGE(STATUS "Creation of ${output}")
-CONFIGURE_FILE(${input} ${output} @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/MED_version.h DESTINATION ${MED_salomeinclude_HEADERS})
+ENDIF(NOT SALOME_MED_STANDALONE)
+
+IF(NOT SALOME_MED_MICROMED)
+ IF(SALOME_MED_WITH_FILE_EXAMPLES)
+ ADD_SUBDIRECTORY(resources)
+ ENDIF(SALOME_MED_WITH_FILE_EXAMPLES)
+ENDIF(NOT SALOME_MED_MICROMED)
+
+# Configuration export
+# ====================
+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"
+SET(_${PROJECT_NAME}_exposed_targets
+ interpkernel medcoupling medcouplingremapper)
+
+IF(NOT SALOME_MED_MICROMED)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets medloader)
+ IF(SALOME_MED_ENABLE_RENUMBER)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets renumbercpp)
+ ENDIF()
+ IF(SALOME_MED_ENABLE_PARTITIONER)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets medpartitionercpp)
+ IF(SALOME_BUILD_TESTS)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets MEDPARTITIONERTest)
+ ENDIF()
+ ENDIF()
+ IF(SALOME_BUILD_TESTS)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets InterpKernelTest)
+ ENDIF()
+ENDIF()
+
+IF(SALOME_USE_MPI)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets paramedmem)
+ IF(NOT SALOME_MED_MICROMED)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets paramedloader)
+ ENDIF()
+ IF(NOT SALOME_MED_STANDALONE)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ paramedcouplingcorba paramedmemcompo)
+ ENDIF()
+ IF(SALOME_BUILD_TESTS)
+ IF(NOT SALOME_MED_MICROMED)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets ParaMEDMEMTest)
+ ENDIF()
+ ENDIF()
+ENDIF()
+
+IF(NOT SALOME_MED_STANDALONE)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ SalomeIDLMED SalomeIDLMEDTests medcouplingcorba medcouplingclient)
+ IF(NOT SALOME_MED_MICROMED)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets medcalculator MEDOPFactoryEngine)
+ IF(SALOME_MED_ENABLE_PYTHON)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets medcalculatorspython)
+ ENDIF()
+ ENDIF()
+ENDIF()
+
+IF(SALOME_BUILD_GUI)
+ IF(NOT SALOME_MED_MICROMED)
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ MEDOPGUI_dialogs MEDOPGUI)
+ ENDIF()
+ENDIF()
+
+# Add all targets to the build-tree export set
+
+EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
+ FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
+
+# Create the configuration files:
+# - in the build tree:
+
+# Ensure the variables are always defined for the configure (even if empty):
+SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
+SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
+SET(MEDFILE_ROOT_DIR "${MEDFILE_ROOT_DIR}")
+SET(MPI_ROOT_DIR "${MPI_ROOT_DIR}")
+SET(HDF5_ROOT_DIR "${HDF5_ROOT_DIR}")
+SET(OMNIORB_ROOT_DIR "${OMNIORB_ROOT_DIR}")
+SET(PTHREAD_ROOT_DIR "${PTHREAD_ROOT_DIR}")
+SET(BOOST_ROOT_DIR "${BOOST_ROOT_DIR}")
+SET(SWIG_ROOT_DIR "${SWIG_ROOT_DIR}")
+SET(PYTHON_ROOT_DIR "${PYTHON_ROOT_DIR}")
+SET(CPPUNIT_ROOT_DIR "${CPPUNIT_ROOT_DIR}")
+SET(GRAPHVIZ_ROOT_DIR "${GRAPHVIZ_ROOT_DIR}")
+SET(DOXYGEN_ROOT_DIR "${DOXYGEN_ROOT_DIR}")
+SET(SPHINX_ROOT_DIR "${SPHINX_ROOT_DIR}")
+
+SET(METIS_ROOT_DIR "${METIS_ROOT_DIR}")
+SET(PARMETIS_ROOT_DIR "${PARMETIS_ROOT_DIR}")
+SET(SCOTCH_ROOT_DIR "${SCOTCH_ROOT_DIR}")
+SET(XDR_ROOT_DIR "${XDR_ROOT_DIR}")
+
+# - in the install tree:
+# 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}")
+
+# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
+SALOME_CONFIGURE_PREPARE(Metis ParMetis Scotch XDR CAS Qt4 CppUnit Graphviz Doxygen Sphinx MPI omniORB
+ PThread Boost libXml2 Python HDF5 MEDFile)
+
+CONFIGURE_PACKAGE_CONFIG_FILE(${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 MEDFILE_ROOT_DIR MPI_ROOT_DIR
+ HDF5_ROOT_DIR OMNIORB_ROOT_DIR PTHREAD_ROOT_DIR BOOST_ROOT_DIR
+ SWIG_ROOT_DIR PYTHON_ROOT_DIR CPPUNIT_ROOT_DIR GRAPHVIZ_ROOT_DIR DOXYGEN_ROOT_DIR
+ SPHINX_ROOT_DIR METIS_ROOT_DIR PARMETIS_ROOT_DIR SCOTCH_ROOT_DIR XDR_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}/to_install/${PROJECT_NAME}Config.cmake"
+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
+
+# 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)