Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/paravis.git] / src / Plugins / MedReader / CMakeLists.txt
1 # Copyright (C) 2010-2012  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 project(MedReader)
21          
22 cmake_minimum_required(VERSION 2.8)
23         
24 if(COMMAND cmake_policy)
25          cmake_policy(SET CMP0003 NEW)
26 endif(COMMAND cmake_policy)
27                 
28 SET(MED_READER_MAJOR_VERSION 3)
29 SET(MED_READER_MINOR_VERSION 1)
30 SET(MED_READER_BUILD_VERSION 0)
31 SET(MED_READER_VERSION
32     "${MED_READER_MAJOR_VERSION}.${MED_READER_MINOR_VERSION}.${MED_READER_BUILD_VERSION}")
33
34 #
35 # Load the ParaView/VTK packages
36 #
37 set(MedReader_BUILD_ParaView_Plugin ON CACHE BOOL "Build the ParaView plugin")
38
39 if(MedReader_BUILD_ParaView_Plugin)
40     FIND_PACKAGE(ParaView REQUIRED)
41     if(NOT ParaView_FOUND)
42         MESSAGE(FATAL_ERROR "Please locate ParaView." )
43     ENDIF(NOT ParaView_FOUND)
44     INCLUDE(${PARAVIEW_USE_FILE})
45 else(MedReader_BUILD_ParaView_Plugin)
46     FIND_PACKAGE(VTK REQUIRED)
47     if(NOT VTK_FOUND)
48         MESSAGE(FATAL_ERROR "Please locate VTK." )
49     ENDIF(NOT VTK_FOUND)
50     INCLUDE(${VTK_USE_FILE})
51 endif(MedReader_BUILD_ParaView_Plugin)
52
53          
54 # Standard CMake option for building libraries shared or static by default.
55 OPTION(BUILD_SHARED_LIBS
56        "Build with shared libraries."
57        ${VTK_BUILD_SHARED_LIBS})
58 #
59 # Find dependant Library
60 #
61 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} )
62 FIND_PACKAGE(MED REQUIRED)
63 include_directories(${MED_INCLUDE_DIRS})
64
65 #
66 # Build the vtkMedReader
67 #
68 add_subdirectory(IO)
69
70 #
71 # Build the parallel vtkPMedReader
72 #
73 set(MedReader_BUILD_PARALLEL ${VTK_USE_PARALLEL} CACHE BOOL "Build the Med Reader with parallel support.")
74
75 #
76 # Build the ParaView Plugin
77 #
78 if(MedReader_BUILD_ParaView_Plugin)
79         add_subdirectory(ParaViewPlugin)
80 endif(MedReader_BUILD_ParaView_Plugin)
81
82
83